初始化
This commit is contained in:
124
BLV_Studio/Test/GridTest/AddDeviceForm/NormalDev.Designer.vb
generated
Normal file
124
BLV_Studio/Test/GridTest/AddDeviceForm/NormalDev.Designer.vb
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
||||
Partial Class NormalDev
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
'Form 重写 Dispose,以清理组件列表。
|
||||
<System.Diagnostics.DebuggerNonUserCode()>
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Windows 窗体设计器所必需的
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'注意: 以下过程是 Windows 窗体设计器所必需的
|
||||
'可以使用 Windows 窗体设计器修改它。
|
||||
'不要使用代码编辑器修改它。
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Me.Label6 = New System.Windows.Forms.Label()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
|
||||
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
|
||||
Me.Table_Grid1 = New FlexCell.Grid()
|
||||
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SplitContainer1.Panel1.SuspendLayout()
|
||||
Me.SplitContainer1.Panel2.SuspendLayout()
|
||||
Me.SplitContainer1.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'Label6
|
||||
'
|
||||
Me.Label6.Dock = System.Windows.Forms.DockStyle.Left
|
||||
Me.Label6.Font = New System.Drawing.Font("宋体", 15.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||
Me.Label6.Location = New System.Drawing.Point(0, 0)
|
||||
Me.Label6.Name = "Label6"
|
||||
Me.Label6.Size = New System.Drawing.Size(105, 45)
|
||||
Me.Label6.TabIndex = 11
|
||||
Me.Label6.Text = "背光灯:"
|
||||
Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
|
||||
'
|
||||
'Button1
|
||||
'
|
||||
Me.Button1.Dock = System.Windows.Forms.DockStyle.Right
|
||||
Me.Button1.Font = New System.Drawing.Font("宋体", 15.0!)
|
||||
Me.Button1.Location = New System.Drawing.Point(646, 0)
|
||||
Me.Button1.Name = "Button1"
|
||||
Me.Button1.Size = New System.Drawing.Size(154, 45)
|
||||
Me.Button1.TabIndex = 12
|
||||
Me.Button1.Text = "确定"
|
||||
Me.Button1.UseVisualStyleBackColor = True
|
||||
'
|
||||
'SplitContainer1
|
||||
'
|
||||
Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.SplitContainer1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.SplitContainer1.Name = "SplitContainer1"
|
||||
Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
|
||||
'
|
||||
'SplitContainer1.Panel1
|
||||
'
|
||||
Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBox1)
|
||||
Me.SplitContainer1.Panel1.Controls.Add(Me.Label6)
|
||||
Me.SplitContainer1.Panel1.Controls.Add(Me.Button1)
|
||||
'
|
||||
'SplitContainer1.Panel2
|
||||
'
|
||||
Me.SplitContainer1.Panel2.Controls.Add(Me.Table_Grid1)
|
||||
Me.SplitContainer1.Size = New System.Drawing.Size(800, 450)
|
||||
Me.SplitContainer1.SplitterDistance = 45
|
||||
Me.SplitContainer1.TabIndex = 13
|
||||
'
|
||||
'ComboBox1
|
||||
'
|
||||
Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
|
||||
Me.ComboBox1.Font = New System.Drawing.Font("宋体", 21.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||
Me.ComboBox1.FormattingEnabled = True
|
||||
Me.ComboBox1.Location = New System.Drawing.Point(111, 5)
|
||||
Me.ComboBox1.Name = "ComboBox1"
|
||||
Me.ComboBox1.Size = New System.Drawing.Size(85, 37)
|
||||
Me.ComboBox1.TabIndex = 13
|
||||
'
|
||||
'Table_Grid1
|
||||
'
|
||||
Me.Table_Grid1.CheckedImage = Nothing
|
||||
Me.Table_Grid1.Cols = 3
|
||||
Me.Table_Grid1.DefaultFont = New System.Drawing.Font("宋体", 9.0!)
|
||||
Me.Table_Grid1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.Table_Grid1.ExtendLastCol = True
|
||||
Me.Table_Grid1.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||
Me.Table_Grid1.GridColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer))
|
||||
Me.Table_Grid1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.Table_Grid1.Name = "Table_Grid1"
|
||||
Me.Table_Grid1.Size = New System.Drawing.Size(800, 401)
|
||||
Me.Table_Grid1.TabIndex = 19
|
||||
Me.Table_Grid1.UncheckedImage = Nothing
|
||||
'
|
||||
'NormalDev
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(800, 450)
|
||||
Me.Controls.Add(Me.SplitContainer1)
|
||||
Me.Name = "NormalDev"
|
||||
Me.Text = "NormalDev"
|
||||
Me.SplitContainer1.Panel1.ResumeLayout(False)
|
||||
Me.SplitContainer1.Panel2.ResumeLayout(False)
|
||||
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.SplitContainer1.ResumeLayout(False)
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
Friend WithEvents Label6 As Label
|
||||
Friend WithEvents Button1 As Button
|
||||
Friend WithEvents SplitContainer1 As SplitContainer
|
||||
Friend WithEvents ComboBox1 As ComboBox
|
||||
Friend WithEvents Table_Grid1 As FlexCell.Grid
|
||||
End Class
|
||||
120
BLV_Studio/Test/GridTest/AddDeviceForm/NormalDev.resx
Normal file
120
BLV_Studio/Test/GridTest/AddDeviceForm/NormalDev.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
192
BLV_Studio/Test/GridTest/AddDeviceForm/NormalDev.vb
Normal file
192
BLV_Studio/Test/GridTest/AddDeviceForm/NormalDev.vb
Normal file
@@ -0,0 +1,192 @@
|
||||
Imports System.ComponentModel
|
||||
Imports FlexCell
|
||||
Public Class NormalDev
|
||||
|
||||
Enum Tcolname
|
||||
<Description("输入序号")>
|
||||
输入序号 = 0
|
||||
|
||||
<Description("设备别名")>
|
||||
按键别名
|
||||
<Description("背光")>
|
||||
按键反馈灯
|
||||
|
||||
max
|
||||
End Enum
|
||||
|
||||
Public ResulDic As Dictionary(Of String, String)
|
||||
Public Resultmodel As DeviceModel
|
||||
Public g_Devicemodel As Dictionary(Of String, DeviceModel)
|
||||
Public isok As Boolean = False
|
||||
Private G_father As AddPeripherals
|
||||
Private Sub NormalDev_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub ShowForm(parentControl As Control, father As AddPeripherals)
|
||||
FormBorderStyle = FormBorderStyle.None
|
||||
TopLevel = False
|
||||
Dock = DockStyle.Fill
|
||||
Parent = parentControl
|
||||
G_father = father
|
||||
'Station_Changed()
|
||||
Show()
|
||||
End Sub
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
|
||||
'ResulDic = New Dictionary(Of String, String)
|
||||
|
||||
'If IsNothing(Resultmodel) Then
|
||||
' MsgBox("添加设备失败,未选中设备!")
|
||||
' Return
|
||||
'End If
|
||||
|
||||
'If IsNothing(g_Devicemodel) Then
|
||||
' MsgBox("添加设备失败,未添加中主机模型!")
|
||||
' Return
|
||||
'End If
|
||||
|
||||
'If String.IsNullOrEmpty(TextBox1.Text) OrElse String.IsNullOrEmpty(TextBox2.Text) Then
|
||||
' MsgBox("添加设备失败,设备别名或设备地址为空!")
|
||||
' Return
|
||||
'End If
|
||||
|
||||
'Dim olddevname As String = Resultmodel.Name
|
||||
'Dim newdevname As String = $"{TextBox1.Text.Trim }{vbLf}设备端口:{Resultmodel.Desc.DevInterface }{vbLf}设备地址:{TextBox2.Text.Trim }"
|
||||
''存在且原名和旧名不一样 则为新设备
|
||||
'If g_Devicemodel.ContainsKey(newdevname) AndAlso Not (newdevname.Equals(olddevname)) Then
|
||||
' MsgBox("添加设备失败,已存在相同别名相同设备地址的设备!!")
|
||||
' Return
|
||||
'Else
|
||||
|
||||
' If isok And g_Devicemodel.ContainsKey(olddevname) Then
|
||||
' g_Devicemodel.Remove(olddevname)
|
||||
' End If
|
||||
' SetDevModeAindex(Resultmodel, "拨码地址", TextBox2.Text.Trim)
|
||||
' Resultmodel.Name = newdevname
|
||||
' g_Devicemodel.Add(newdevname, Resultmodel)
|
||||
|
||||
'End If
|
||||
|
||||
'For i = 1 To Table_Grid1.Rows - 1
|
||||
' ResulDic.Add(Table_Grid1.Cell(i, Tcolname.输入序号).Text.Trim, Table_Grid1.Cell(i, Tcolname.按键反馈灯).Text.Trim)
|
||||
'Next
|
||||
|
||||
G_father.DialogResult = System.Windows.Forms.DialogResult.OK
|
||||
G_father.Close()
|
||||
Return
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub initTable()
|
||||
|
||||
Table_Grid1.Rows = 1
|
||||
Table_Grid1.Cols = Tcolname.max
|
||||
Table_Grid1.ExtendLastCol = True
|
||||
For i = 0 To Tcolname.max - 1
|
||||
Table_Grid1.Cell(0, i).Text = [Enum].GetName(GetType(Tcolname), i)
|
||||
Select Case i
|
||||
Case Tcolname.输入序号
|
||||
With Table_Grid1.Column(i)
|
||||
.Width = 50
|
||||
'.Visible = True
|
||||
.Locked = True
|
||||
End With
|
||||
|
||||
Case Tcolname.按键别名
|
||||
With Table_Grid1.Column(i)
|
||||
.Width = 350
|
||||
.Alignment = FlexCell.AlignmentEnum.CenterCenter
|
||||
|
||||
End With
|
||||
Case Tcolname.按键反馈灯
|
||||
With Table_Grid1.Column(i)
|
||||
.Width = 100
|
||||
.Alignment = FlexCell.AlignmentEnum.CenterCenter
|
||||
'.Locked = True
|
||||
.CellType = CellTypeEnum.ComboBox
|
||||
End With
|
||||
Table_Grid1.ComboBox(i).Locked = True
|
||||
Case Else
|
||||
Exit For
|
||||
End Select
|
||||
|
||||
Next
|
||||
|
||||
AddGrid1RowDragDrop()
|
||||
End Sub
|
||||
Private Do_li As List(Of String)
|
||||
Private Sub AddGrid1RowDragDrop()
|
||||
Do_li = New List(Of String)
|
||||
If Not IsNothing(Resultmodel) Then
|
||||
For Each ModuleFre In Resultmodel.Nodes
|
||||
|
||||
If ModuleFre.Name.Equals("Dimming") Then
|
||||
|
||||
ElseIf ModuleFre.Name.Equals("RELAY") Then
|
||||
|
||||
ElseIf ModuleFre.Name.Equals("DI") Then
|
||||
For Each index In ModuleFre.Nodes
|
||||
Table_Grid1.AddItem("")
|
||||
Table_Grid1.Cell(Table_Grid1.Rows - 1, 0).Text = index.LoopAddr
|
||||
Table_Grid1.Cell(Table_Grid1.Rows - 1, 1).Text = index.DefaultAliasName
|
||||
Table_Grid1.Cell(Table_Grid1.Rows - 1, 2).Text = index.LoopAddr
|
||||
Next
|
||||
|
||||
ElseIf ModuleFre.Name.Equals("MUSIC") Then
|
||||
|
||||
ElseIf ModuleFre.Name.Equals("DO") Then
|
||||
For Each index In ModuleFre.Nodes
|
||||
Do_li.Add(index.LoopAddr)
|
||||
Next
|
||||
ComboBox1.Items.AddRange(Do_li.ToArray)
|
||||
ComboBox1.SelectedIndex = ComboBox1.Items.Count - 1
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Table_Grid1_ComboDropDown(Sender As Object, e As Grid.ComboDropDownEventArgs) Handles Table_Grid1.ComboDropDown
|
||||
|
||||
Table_Grid1.ComboBox(Tcolname.按键反馈灯).Items.Clear()
|
||||
If IsNothing(Do_li) Then Return
|
||||
|
||||
Table_Grid1.ComboBox(Tcolname.按键反馈灯).Items.AddRange(Do_li.ToArray)
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Table_Grid1_CellChange(Sender As Object, e As Grid.CellChangeEventArgs) Handles Table_Grid1.CellChange
|
||||
If e.Row > 0 Then
|
||||
Select Case e.Col
|
||||
Case Tcolname.按键别名
|
||||
Dim LoopAddr As String = Table_Grid1.Cell(e.Row, Tcolname.输入序号).Text.Trim
|
||||
For Each ModuleFre In Resultmodel.Nodes
|
||||
If ModuleFre.Interface.Equals("DI") Then
|
||||
For Each index In ModuleFre.Nodes
|
||||
If LoopAddr.Equals(index.LoopAddr) Then
|
||||
index.DefaultAliasName = Table_Grid1.Cell(e.Row, Tcolname.按键别名).Text.Trim
|
||||
Return
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
Case Tcolname.按键反馈灯
|
||||
Dim LoopAddr As String = Table_Grid1.Cell(e.Row, Tcolname.按键反馈灯).Text.Trim
|
||||
For Each ModuleFre In Resultmodel.Nodes
|
||||
If ModuleFre.Interface.Equals("DO") Then
|
||||
For Each index In ModuleFre.Nodes
|
||||
If LoopAddr.Equals(index.LoopAddr) Then
|
||||
Return
|
||||
End If
|
||||
Next
|
||||
MsgBox("背光序号不存在!!将恢复默认调光序号!")
|
||||
Table_Grid1.Cell(e.Row, Tcolname.按键反馈灯).Text = Table_Grid1.Cell(e.Row, Tcolname.输入序号).Text
|
||||
End If
|
||||
Next
|
||||
End Select
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user