diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..de98f45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +packages +BLV_Studio/bin +BLV_Studio/bin +BLV_Studio/bin/Debug +BLV_Studio/bin/Debug/app.publish +*.application +BLV_Studio/obj diff --git a/.vs/BLV_Studio/v16/.suo b/.vs/BLV_Studio/v16/.suo index dd21f94..9d6748e 100644 Binary files a/.vs/BLV_Studio/v16/.suo and b/.vs/BLV_Studio/v16/.suo differ diff --git a/BLV_Studio/My Project/AssemblyInfo.vb b/BLV_Studio/My Project/AssemblyInfo.vb index 9577747..a4b10c8 100644 --- a/BLV_Studio/My Project/AssemblyInfo.vb +++ b/BLV_Studio/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices '通过使用 "*",如下所示: ' - - + + diff --git a/BLV_Studio/Test/GridTest/PowerSupply.Designer.vb b/BLV_Studio/Test/GridTest/PowerSupply.Designer.vb index ad37d6f..2cb4359 100644 --- a/BLV_Studio/Test/GridTest/PowerSupply.Designer.vb +++ b/BLV_Studio/Test/GridTest/PowerSupply.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class PowerSupply Inherits System.Windows.Forms.Form 'Form 重写 Dispose,以清理组件列表。 - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,34 +20,33 @@ Partial Class PowerSupply '注意: 以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改它。 '不要使用代码编辑器修改它。 - _ + Private Sub InitializeComponent() Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() Me.Label4 = New System.Windows.Forms.Label() Me.CheckBox5 = New System.Windows.Forms.CheckBox() + Me.Label3 = New System.Windows.Forms.Label() Me.Button4 = New System.Windows.Forms.Button() Me.Label2 = New System.Windows.Forms.Label() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.Label1 = New System.Windows.Forms.Label() Me.CheckBox3 = New System.Windows.Forms.CheckBox() Me.Button1 = New System.Windows.Forms.Button() - Me.CheckBox2 = New System.Windows.Forms.CheckBox() - Me.CheckBox1 = New System.Windows.Forms.CheckBox() Me.SplitContainer2 = New System.Windows.Forms.SplitContainer() Me.SplitContainer3 = New System.Windows.Forms.SplitContainer() Me.PortTable = New FlexCell.Grid() - Me.Button5 = New System.Windows.Forms.Button() - Me.Button6 = New System.Windows.Forms.Button() - Me.Button3 = New System.Windows.Forms.Button() - Me.Button2 = New System.Windows.Forms.Button() + Me.CheckBox6 = New System.Windows.Forms.CheckBox() + Me.ComboBox1 = New System.Windows.Forms.ComboBox() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.Label5 = New System.Windows.Forms.Label() Me.NR_ComboBox1 = New System.Windows.Forms.ComboBox() Me.NR_TextBox2 = New System.Windows.Forms.TextBox() Me.NR_label3 = New System.Windows.Forms.Label() Me.CheckBox4 = New System.Windows.Forms.CheckBox() - Me.Button7 = New System.Windows.Forms.Button() - Me.Button8 = New System.Windows.Forms.Button() - Me.Button9 = New System.Windows.Forms.Button() - Me.Button10 = New System.Windows.Forms.Button() + Me.Button5 = New System.Windows.Forms.Button() + Me.Button6 = New System.Windows.Forms.Button() + Me.Button3 = New System.Windows.Forms.Button() + Me.Button2 = New System.Windows.Forms.Button() Me.IfGrid = New FlexCell.Grid() CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainer1.Panel1.SuspendLayout() @@ -74,48 +73,57 @@ Partial Class PowerSupply ' Me.SplitContainer1.Panel1.Controls.Add(Me.Label4) Me.SplitContainer1.Panel1.Controls.Add(Me.CheckBox5) + Me.SplitContainer1.Panel1.Controls.Add(Me.Label3) Me.SplitContainer1.Panel1.Controls.Add(Me.Button4) Me.SplitContainer1.Panel1.Controls.Add(Me.Label2) Me.SplitContainer1.Panel1.Controls.Add(Me.TextBox1) Me.SplitContainer1.Panel1.Controls.Add(Me.Label1) Me.SplitContainer1.Panel1.Controls.Add(Me.CheckBox3) Me.SplitContainer1.Panel1.Controls.Add(Me.Button1) - Me.SplitContainer1.Panel1.Controls.Add(Me.CheckBox2) - Me.SplitContainer1.Panel1.Controls.Add(Me.CheckBox1) ' 'SplitContainer1.Panel2 ' Me.SplitContainer1.Panel2.Controls.Add(Me.SplitContainer2) - Me.SplitContainer1.Size = New System.Drawing.Size(1260, 739) - Me.SplitContainer1.SplitterDistance = 78 + Me.SplitContainer1.Size = New System.Drawing.Size(1177, 735) + Me.SplitContainer1.SplitterDistance = 77 Me.SplitContainer1.TabIndex = 1 ' 'Label4 ' Me.Label4.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) Me.Label4.ForeColor = System.Drawing.Color.Red - Me.Label4.Location = New System.Drawing.Point(12, 10) + Me.Label4.Location = New System.Drawing.Point(3, 9) Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(895, 23) - Me.Label4.TabIndex = 53 - Me.Label4.Text = "Note: The door magnet must be selected in the configuration of the door magnet lo" & - "op" + Me.Label4.Size = New System.Drawing.Size(385, 23) + Me.Label4.TabIndex = 51 + Me.Label4.Text = "Note: The door magnet must be selected in the configuration of the door magnet loop" ' 'CheckBox5 ' Me.CheckBox5.AutoSize = True Me.CheckBox5.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) - Me.CheckBox5.Location = New System.Drawing.Point(16, 43) + Me.CheckBox5.Location = New System.Drawing.Point(453, 43) Me.CheckBox5.Name = "CheckBox5" - Me.CheckBox5.Size = New System.Drawing.Size(359, 25) - Me.CheckBox5.TabIndex = 52 + Me.CheckBox5.Size = New System.Drawing.Size(155, 25) + Me.CheckBox5.TabIndex = 51 Me.CheckBox5.Text = "Enable the power supply button" Me.CheckBox5.UseVisualStyleBackColor = True + Me.CheckBox5.Visible = False + ' + 'Label3 + ' + Me.Label3.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) + Me.Label3.ForeColor = System.Drawing.Color.Red + Me.Label3.Location = New System.Drawing.Point(348, 27) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(8, 8) + Me.Label3.TabIndex = 50 + Me.Label3.Text = "Requires a configured magnetic/radar loop" ' 'Button4 ' Me.Button4.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) - Me.Button4.Location = New System.Drawing.Point(636, 34) + Me.Button4.Location = New System.Drawing.Point(911, 31) Me.Button4.Name = "Button4" Me.Button4.Size = New System.Drawing.Size(125, 37) Me.Button4.TabIndex = 6 @@ -157,7 +165,7 @@ Partial Class PowerSupply Me.CheckBox3.AutoSize = True Me.CheckBox3.Enabled = False Me.CheckBox3.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) - Me.CheckBox3.Location = New System.Drawing.Point(36, 43) + Me.CheckBox3.Location = New System.Drawing.Point(7, 43) Me.CheckBox3.Name = "CheckBox3" Me.CheckBox3.Size = New System.Drawing.Size(440, 25) Me.CheckBox3.TabIndex = 3 @@ -168,35 +176,13 @@ Partial Class PowerSupply 'Button1 ' Me.Button1.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) - Me.Button1.Location = New System.Drawing.Point(770, 35) + Me.Button1.Location = New System.Drawing.Point(1045, 32) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(125, 37) Me.Button1.TabIndex = 2 Me.Button1.Text = "OK" Me.Button1.UseVisualStyleBackColor = True ' - 'CheckBox2 - ' - Me.CheckBox2.AutoSize = True - Me.CheckBox2.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) - Me.CheckBox2.Location = New System.Drawing.Point(194, 12) - Me.CheckBox2.Name = "CheckBox2" - Me.CheckBox2.Size = New System.Drawing.Size(113, 25) - Me.CheckBox2.TabIndex = 1 - Me.CheckBox2.Text = "有卡取电" - Me.CheckBox2.UseVisualStyleBackColor = True - ' - 'CheckBox1 - ' - Me.CheckBox1.AutoSize = True - Me.CheckBox1.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) - Me.CheckBox1.Location = New System.Drawing.Point(36, 12) - Me.CheckBox1.Name = "CheckBox1" - Me.CheckBox1.Size = New System.Drawing.Size(113, 25) - Me.CheckBox1.TabIndex = 0 - Me.CheckBox1.Text = "无卡取电" - Me.CheckBox1.UseVisualStyleBackColor = True - ' 'SplitContainer2 ' Me.SplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill @@ -211,8 +197,8 @@ Partial Class PowerSupply 'SplitContainer2.Panel2 ' Me.SplitContainer2.Panel2.Controls.Add(Me.IfGrid) - Me.SplitContainer2.Size = New System.Drawing.Size(1260, 657) - Me.SplitContainer2.SplitterDistance = 216 + Me.SplitContainer2.Size = New System.Drawing.Size(1177, 654) + Me.SplitContainer2.SplitterDistance = 259 Me.SplitContainer2.TabIndex = 0 ' 'SplitContainer3 @@ -227,172 +213,183 @@ Partial Class PowerSupply ' 'SplitContainer3.Panel2 ' - Me.SplitContainer3.Panel2.Controls.Add(Me.Button5) - Me.SplitContainer3.Panel2.Controls.Add(Me.Button6) - Me.SplitContainer3.Panel2.Controls.Add(Me.Button3) - Me.SplitContainer3.Panel2.Controls.Add(Me.Button2) + Me.SplitContainer3.Panel2.Controls.Add(Me.CheckBox6) + Me.SplitContainer3.Panel2.Controls.Add(Me.ComboBox1) + Me.SplitContainer3.Panel2.Controls.Add(Me.TextBox2) + Me.SplitContainer3.Panel2.Controls.Add(Me.Label5) Me.SplitContainer3.Panel2.Controls.Add(Me.NR_ComboBox1) Me.SplitContainer3.Panel2.Controls.Add(Me.NR_TextBox2) Me.SplitContainer3.Panel2.Controls.Add(Me.NR_label3) Me.SplitContainer3.Panel2.Controls.Add(Me.CheckBox4) - Me.SplitContainer3.Panel2.Controls.Add(Me.Button7) - Me.SplitContainer3.Panel2.Controls.Add(Me.Button8) - Me.SplitContainer3.Panel2.Controls.Add(Me.Button9) - Me.SplitContainer3.Panel2.Controls.Add(Me.Button10) - Me.SplitContainer3.Size = New System.Drawing.Size(1260, 216) - Me.SplitContainer3.SplitterDistance = 754 + Me.SplitContainer3.Panel2.Controls.Add(Me.Button5) + Me.SplitContainer3.Panel2.Controls.Add(Me.Button6) + Me.SplitContainer3.Panel2.Controls.Add(Me.Button3) + Me.SplitContainer3.Panel2.Controls.Add(Me.Button2) + Me.SplitContainer3.Size = New System.Drawing.Size(1177, 259) + Me.SplitContainer3.SplitterDistance = 922 Me.SplitContainer3.TabIndex = 0 ' 'PortTable ' - Me.PortTable.CheckedImage = Nothing Me.PortTable.DefaultFont = New System.Drawing.Font("宋体", 9.0!) Me.PortTable.Dock = System.Windows.Forms.DockStyle.Fill Me.PortTable.ExtendLastCol = True - Me.PortTable.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) Me.PortTable.GridColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) Me.PortTable.Location = New System.Drawing.Point(0, 0) + Me.PortTable.MouseWheelSpeed = CType(3, Short) Me.PortTable.Name = "PortTable" - Me.PortTable.Size = New System.Drawing.Size(754, 216) + Me.PortTable.Size = New System.Drawing.Size(922, 259) Me.PortTable.TabIndex = 1 - Me.PortTable.UncheckedImage = Nothing ' - 'Button5 + 'CheckBox6 ' - Me.Button5.Location = New System.Drawing.Point(287, 114) - Me.Button5.Name = "Button5" - Me.Button5.Size = New System.Drawing.Size(171, 46) - Me.Button5.TabIndex = 3 - Me.Button5.Text = "Add condition group" - Me.Button5.UseVisualStyleBackColor = True + Me.CheckBox6.Font = New System.Drawing.Font("宋体", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) + Me.CheckBox6.Location = New System.Drawing.Point(5, 74) + Me.CheckBox6.Name = "CheckBox6" + Me.CheckBox6.Size = New System.Drawing.Size(227, 20) + Me.CheckBox6.TabIndex = 11 + Me.CheckBox6.Text = "Key-triggered occupancy reset" + Me.CheckBox6.UseVisualStyleBackColor = True + Me.CheckBox6.Visible = False ' - 'Button6 + 'ComboBox1 ' - Me.Button6.Location = New System.Drawing.Point(21, 114) - Me.Button6.Name = "Button6" - Me.Button6.Size = New System.Drawing.Size(187, 46) - Me.Button6.TabIndex = 2 - Me.Button6.Text = "Delete condition group" & Global.Microsoft.VisualBasic.ChrW(10) - Me.Button6.UseVisualStyleBackColor = True + Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.ComboBox1.FormattingEnabled = True + Me.ComboBox1.Items.AddRange(New Object() {"s", "m", "h"}) + Me.ComboBox1.Location = New System.Drawing.Point(204, 124) + Me.ComboBox1.Name = "ComboBox1" + Me.ComboBox1.Size = New System.Drawing.Size(41, 20) + Me.ComboBox1.TabIndex = 10 + Me.ComboBox1.Visible = False ' - 'Button3 + 'TextBox2 ' - Me.Button3.Location = New System.Drawing.Point(287, 166) - Me.Button3.Name = "Button3" - Me.Button3.Size = New System.Drawing.Size(171, 38) - Me.Button3.TabIndex = 1 - Me.Button3.Text = "Add condition" - Me.Button3.UseVisualStyleBackColor = True + Me.TextBox2.Location = New System.Drawing.Point(98, 123) + Me.TextBox2.MaxLength = 3 + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.Size = New System.Drawing.Size(100, 21) + Me.TextBox2.TabIndex = 9 + Me.TextBox2.Text = "10" + Me.TextBox2.Visible = False ' - 'Button2 + 'Label5 ' - Me.Button2.Location = New System.Drawing.Point(21, 166) - Me.Button2.Name = "Button2" - Me.Button2.Size = New System.Drawing.Size(187, 38) - Me.Button2.TabIndex = 0 - Me.Button2.Text = "Delete condition" - Me.Button2.UseVisualStyleBackColor = True + Me.Label5.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) + Me.Label5.Location = New System.Drawing.Point(3, 97) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(167, 23) + Me.Label5.TabIndex = 8 + Me.Label5.Text = "Timeout for the final step of Occupied→Unoccupied transition:" + Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.Label5.Visible = False ' 'NR_ComboBox1 ' Me.NR_ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.NR_ComboBox1.Enabled = False Me.NR_ComboBox1.FormattingEnabled = True - Me.NR_ComboBox1.Items.AddRange(New Object() {"秒", "分", "时"}) - Me.NR_ComboBox1.Location = New System.Drawing.Point(239, 42) + Me.NR_ComboBox1.Items.AddRange(New Object() {"s", "m", "h"}) + Me.NR_ComboBox1.Location = New System.Drawing.Point(204, 39) Me.NR_ComboBox1.Name = "NR_ComboBox1" Me.NR_ComboBox1.Size = New System.Drawing.Size(41, 20) Me.NR_ComboBox1.TabIndex = 7 + Me.NR_ComboBox1.Visible = False ' 'NR_TextBox2 ' Me.NR_TextBox2.Enabled = False - Me.NR_TextBox2.Location = New System.Drawing.Point(133, 41) + Me.NR_TextBox2.Location = New System.Drawing.Point(98, 38) Me.NR_TextBox2.MaxLength = 3 Me.NR_TextBox2.Name = "NR_TextBox2" Me.NR_TextBox2.Size = New System.Drawing.Size(100, 21) Me.NR_TextBox2.TabIndex = 6 Me.NR_TextBox2.Text = "30" + Me.NR_TextBox2.Visible = False ' 'NR_label3 ' Me.NR_label3.Enabled = False Me.NR_label3.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) - Me.NR_label3.Location = New System.Drawing.Point(3, 39) + Me.NR_label3.Location = New System.Drawing.Point(3, 38) Me.NR_label3.Name = "NR_label3" - Me.NR_label3.Size = New System.Drawing.Size(137, 23) + Me.NR_label3.Size = New System.Drawing.Size(100, 23) Me.NR_label3.TabIndex = 5 - Me.NR_label3.Text = "Unmanned duration" + Me.NR_label3.Text = "Sustained Unoccupied Time:" Me.NR_label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.NR_label3.Visible = False ' 'CheckBox4 ' Me.CheckBox4.Font = New System.Drawing.Font("宋体", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) - Me.CheckBox4.Location = New System.Drawing.Point(2, 15) + Me.CheckBox4.Location = New System.Drawing.Point(3, 15) Me.CheckBox4.Name = "CheckBox4" - Me.CheckBox4.Size = New System.Drawing.Size(355, 20) + Me.CheckBox4.Size = New System.Drawing.Size(187, 20) Me.CheckBox4.TabIndex = 4 - Me.CheckBox4.Text = "Whether continuous is enabled is unknown" + Me.CheckBox4.Text = "Sustain Unoccupied Judgment" Me.CheckBox4.UseVisualStyleBackColor = True + Me.CheckBox4.Visible = False ' - 'Button7 + 'Button5 ' - Me.Button7.Location = New System.Drawing.Point(133, 137) - Me.Button7.Name = "Button7" - Me.Button7.Size = New System.Drawing.Size(75, 23) - Me.Button7.TabIndex = 3 - Me.Button7.Text = "添加条件组" - Me.Button7.UseVisualStyleBackColor = True + Me.Button5.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) + Me.Button5.Location = New System.Drawing.Point(139, 150) + Me.Button5.Name = "Button5" + Me.Button5.Size = New System.Drawing.Size(102, 45) + Me.Button5.TabIndex = 3 + Me.Button5.Text = "Add Condition Group" + Me.Button5.UseVisualStyleBackColor = True ' - 'Button8 + 'Button6 ' - Me.Button8.Location = New System.Drawing.Point(21, 137) - Me.Button8.Name = "Button8" - Me.Button8.Size = New System.Drawing.Size(75, 23) - Me.Button8.TabIndex = 2 - Me.Button8.Text = "删除条件组" - Me.Button8.UseVisualStyleBackColor = True + Me.Button6.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) + Me.Button6.Location = New System.Drawing.Point(18, 150) + Me.Button6.Name = "Button6" + Me.Button6.Size = New System.Drawing.Size(102, 45) + Me.Button6.TabIndex = 2 + Me.Button6.Text = "Delete Condition Group" + Me.Button6.UseVisualStyleBackColor = True ' - 'Button9 + 'Button3 ' - Me.Button9.Location = New System.Drawing.Point(133, 171) - Me.Button9.Name = "Button9" - Me.Button9.Size = New System.Drawing.Size(75, 23) - Me.Button9.TabIndex = 1 - Me.Button9.Text = "添加条件" - Me.Button9.UseVisualStyleBackColor = True + Me.Button3.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) + Me.Button3.Location = New System.Drawing.Point(139, 201) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(102, 45) + Me.Button3.TabIndex = 1 + Me.Button3.Text = "Add Condition" + Me.Button3.UseVisualStyleBackColor = True ' - 'Button10 + 'Button2 ' - Me.Button10.Location = New System.Drawing.Point(21, 171) - Me.Button10.Name = "Button10" - Me.Button10.Size = New System.Drawing.Size(75, 23) - Me.Button10.TabIndex = 0 - Me.Button10.Text = "删除条件" - Me.Button10.UseVisualStyleBackColor = True + Me.Button2.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) + Me.Button2.Location = New System.Drawing.Point(18, 201) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(102, 45) + Me.Button2.TabIndex = 0 + Me.Button2.Text = "Delete Condition" + Me.Button2.UseVisualStyleBackColor = True ' 'IfGrid ' - Me.IfGrid.CheckedImage = Nothing Me.IfGrid.DefaultFont = New System.Drawing.Font("宋体", 9.0!) Me.IfGrid.Dock = System.Windows.Forms.DockStyle.Fill Me.IfGrid.ExtendLastCol = True - Me.IfGrid.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) Me.IfGrid.GridColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) Me.IfGrid.Location = New System.Drawing.Point(0, 0) + Me.IfGrid.MouseWheelSpeed = CType(3, Short) Me.IfGrid.Name = "IfGrid" - Me.IfGrid.Size = New System.Drawing.Size(1260, 437) + Me.IfGrid.Size = New System.Drawing.Size(1177, 391) Me.IfGrid.TabIndex = 1 - Me.IfGrid.UncheckedImage = Nothing ' 'PowerSupply ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(1260, 739) + Me.ClientSize = New System.Drawing.Size(1177, 735) Me.Controls.Add(Me.SplitContainer1) Me.Name = "PowerSupply" - Me.Text = "无卡取电" + Me.Text = "Keycard-Free" Me.SplitContainer1.Panel1.ResumeLayout(False) Me.SplitContainer1.Panel1.PerformLayout() Me.SplitContainer1.Panel2.ResumeLayout(False) @@ -411,8 +408,6 @@ Partial Class PowerSupply End Sub Friend WithEvents SplitContainer1 As SplitContainer - Friend WithEvents CheckBox2 As CheckBox - Friend WithEvents CheckBox1 As CheckBox Friend WithEvents Button1 As Button Friend WithEvents CheckBox3 As CheckBox Friend WithEvents TextBox1 As TextBox @@ -427,14 +422,15 @@ Partial Class PowerSupply Friend WithEvents Button4 As Button Protected WithEvents Button5 As Button Friend WithEvents Button6 As Button - Friend WithEvents Label4 As Label - Friend WithEvents CheckBox5 As CheckBox + Friend WithEvents CheckBox4 As CheckBox + Friend WithEvents NR_label3 As Label Friend WithEvents NR_ComboBox1 As ComboBox Friend WithEvents NR_TextBox2 As TextBox - Friend WithEvents NR_label3 As Label - Friend WithEvents CheckBox4 As CheckBox - Protected WithEvents Button7 As Button - Friend WithEvents Button8 As Button - Protected WithEvents Button9 As Button - Friend WithEvents Button10 As Button + Friend WithEvents Label4 As Label + Friend WithEvents Label3 As Label + Friend WithEvents CheckBox5 As CheckBox + Friend WithEvents ComboBox1 As ComboBox + Friend WithEvents TextBox2 As TextBox + Friend WithEvents Label5 As Label + Friend WithEvents CheckBox6 As CheckBox End Class diff --git a/BLV_Studio/Test/GridTest/PowerSupply.vb b/BLV_Studio/Test/GridTest/PowerSupply.vb index ea9cc84..7622595 100644 --- a/BLV_Studio/Test/GridTest/PowerSupply.vb +++ b/BLV_Studio/Test/GridTest/PowerSupply.vb @@ -1,4 +1,5 @@ Imports BLV_Studio.TableInteraction +Imports FlexCell Imports Newtonsoft.Json Public Class PowerSupply @@ -6,17 +7,36 @@ Public Class PowerSupply ''' 设备键值对 设备名-设备信息集合 主机=主机名 外设=外设名+播马地址 ''' Private Dic_Devicemodel As Dictionary(Of String, DeviceModel) - Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged - CheckBox2.Checked = Not CheckBox1.Checked - SplitContainer1.Panel2.Visible = True - End Sub + 'Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged + ' CheckBox2.Checked = Not CheckBox1.Checked + ' SplitContainer1.Panel2.Visible = True + 'End Sub - Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged - CheckBox1.Checked = Not CheckBox2.Checked - SplitContainer1.Panel2.Visible = False - End Sub + 'Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged + ' CheckBox1.Checked = Not CheckBox2.Checked + ' SplitContainer1.Panel2.Visible = False + 'End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + If Not UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then + Dim msgid As Integer = ConditionCheck() + If msgid > 0 Then + Select Case msgid + Case 1 + MsgBox("The last condition group must be 'from presence to absence'!") + 'Case 2 + ' MsgBox("不能有多组'brief absence'的条件组!") + Case 3 + MsgBox("The 'brief absence' condition group must consist of at least two sets of conditions!") + Case 4 + MsgBox("There cannot be multiple sets of conditions for 'Long-term absence'!") + End Select + Return + End If + + End If + + GetPortTable() GetIfTable() SetDevDescription() @@ -28,24 +48,161 @@ Public Class PowerSupply Else g_TableGrid.Cell(0, 0).Tag = 0 End If - CheckBox5_CheckedChanged(Nothing, Nothing) - End If + '250903 CZH 将设置按键条件 控制取电服务注释,改用设置标志位到无卡取电中 + 'CheckBox5_CheckedChanged(Nothing, Nothing) + '改用设置标志位到无卡取电中 + End If + 'Dim portname, chname As String + 'For i = 1 To PortTable.Rows - 1 + ' portname = PortTable.Cell(i, 2).Text + ' chname = PortTable.Cell(i, 0).Text + ' If String.IsNullOrEmpty(portname) Then Continue For + ' SetG_TableGridService(portname, chname) + 'Next Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() Return End Sub + + Public Sub deleteG_TableGridService(intenndoe As DeviceChildNode) + Dim portname, chname As String + Dim cbuf As String() = intenndoe.Description.Split(",") + If cbuf.Length > 1 Then + portname = cbuf(1) + Else + Return + End If + + + chname = intenndoe.Name + If String.IsNullOrEmpty(portname) Then Return + '从名称中提取场景号绑定端口名称格式为 portname = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}({TableGrid.Cell(i, TableColNumber.SceneID).Text})" + Dim addserviceData As String + Dim sceneid As String = portname.Substring(portname.LastIndexOf("(") + 1, portname.LastIndexOf(")") - portname.LastIndexOf("(") - 1) + Dim serviceData As String + '遍历g_TableGrid表找到该场景号对应行 + Dim tabrows As Integer = g_TableGrid.Rows - 2 + + For tabrow = 1 To tabrows + serviceData = g_TableGrid.Cell(tabrow, TableColNumber.SceneID).Text + If g_TableGrid.Cell(tabrow, TableColNumber.SceneID).Text.Equals(sceneid) Then + serviceData = g_TableGrid.Cell(tabrow, TableColNumber.ServerAttribute).Text + If chname.Contains("CH1") Then + addserviceData = "13,1,0,1," + ElseIf chname.Contains("CH2") Then + addserviceData = "32,1,0,1," + ElseIf chname.Contains("CH3") Then + addserviceData = "33,1,0,1," + ElseIf chname.Contains("CH4") Then + addserviceData = "34,1,0,1," + ElseIf chname.Contains("CH5") Then + addserviceData = "35,1,0,1," + ElseIf chname.Contains("CH6") Then + addserviceData = "36,1,0,1," + ElseIf chname.Contains("CH7") Then + addserviceData = "37,1,0,1," + ElseIf chname.Contains("CH8") Then + addserviceData = "38,1,0,1," + ElseIf chname.Contains("CH9") Then + addserviceData = "39,1,0,1," + ElseIf chname.Contains("CH10") Then + addserviceData = "40,1,0,1," + Else + Return + End If + '判断serviceData是否包含addserviceData + If serviceData.Contains(addserviceData) Then + '清除serviceData中addserviceData + serviceData = serviceData.Replace(addserviceData, "") + '更新g_TableGrid表中的ServerAttribute列 + g_TableGrid.Cell(tabrow, TableColNumber.ServerAttribute).Text = serviceData.Trim + End If + End If + Next + End Sub + + Public Sub SetG_TableGridService(portname As String, chname As String) + Dim serviceData As String + Dim addserviceData As String + ''遍历PortTable表 + 'For i = 1 To PortTable.Rows - 1 + ' '获取绑定端口名称 + ' portname = PortTable.Cell(i, 2).Text + ' chname = PortTable.Cell(i, 0).Text + '判断该名称是否为空 + If String.IsNullOrEmpty(portname) Then Return + '从名称中提取场景号绑定端口名称格式为 portname = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}({TableGrid.Cell(i, TableColNumber.SceneID).Text})" + Dim sceneid As String = portname.Substring(portname.LastIndexOf("(") + 1, portname.LastIndexOf(")") - portname.LastIndexOf("(") - 1) + '遍历g_TableGrid表找到该场景号对应行 + For j = 1 To g_TableGrid.Rows - 1 + If g_TableGrid.Cell(j, TableColNumber.SceneID).Text.Equals(sceneid) Then + serviceData = g_TableGrid.Cell(j, TableColNumber.ServerAttribute).Text + '21,1,0,1, + '21,2,10,2, + If chname.Contains("CH1") Then + addserviceData = "13,1,0,1," + ElseIf chname.Contains("CH2") Then + addserviceData = "32,1,0,1," + ElseIf chname.Contains("CH3") Then + addserviceData = "33,1,0,1," + ElseIf chname.Contains("CH4") Then + addserviceData = "34,1,0,1," + ElseIf chname.Contains("CH5") Then + addserviceData = "35,1,0,1," + ElseIf chname.Contains("CH6") Then + addserviceData = "36,1,0,1," + ElseIf chname.Contains("CH7") Then + addserviceData = "37,1,0,1," + ElseIf chname.Contains("CH8") Then + addserviceData = "38,1,0,1," + ElseIf chname.Contains("CH9") Then + addserviceData = "39,1,0,1," + ElseIf chname.Contains("CH10") Then + addserviceData = "40,1,0,1," + Else + Return + End If + '判断serviceData是否包含addserviceData + If serviceData.Contains(addserviceData) Then + Return + End If + '判断serviceData是否为空 + If String.IsNullOrEmpty(serviceData) Then + serviceData = addserviceData + Else + serviceData = $"{addserviceData}{vbLf}{serviceData}" + End If + g_TableGrid.Cell(j, TableColNumber.ServerAttribute).Text = serviceData + Exit For + End If + Next + + + 'Next + End Sub + + Public Sub SetDevDescription() If IsNothing(UniqueDevice) Then Return Dim rstr = String.Empty + Dim C1 As String If CheckBox4.Checked Then rstr = $"1," Else rstr = $"0," End If - rstr = $"{rstr}{NR_TextBox2.Text },{NR_ComboBox1.SelectedIndex + 1}" + + If CheckBox6.Checked Then + C1 = "1" + Else + C1 = "0" + End If + + + rstr = $"{rstr}{NR_TextBox2.Text.Trim },{NR_ComboBox1.SelectedIndex + 1},{C1},{TextBox2.Text.Trim},{ComboBox1.SelectedIndex + 1}" UniqueDevice.Desc.ProtocolData = rstr End Sub Public Sub GetDevDescription() @@ -61,30 +218,64 @@ Public Class PowerSupply NR_TextBox2.Text = rstr(1) NR_ComboBox1.SelectedIndex = CInt(rstr(2)) - 1 End If + If rstr.Length > 5 Then + If rstr(3).Equals("1") Then + CheckBox6.Checked = True + Else + CheckBox6.Checked = False + End If + TextBox2.Text = rstr(4) + ComboBox1.SelectedIndex = CInt(rstr(5)) - 1 + + End If + + End Sub Public Function GetPortTable() As Boolean If IsNothing(NoCardNode) Then Return False + Dim rstr As String = String.Empty - For i = 1 To PortTable.Rows - 1 - rstr = String.Empty - 'For j = 1 To PortTable.Cols - 1 + If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then + For i = 1 To PortTable.Rows - 1 + rstr = String.Empty + 'For j = 1 To PortTable.Cols - 1 - ' rstr = $"{rstr},{PortTable.Cell(i, j).Text}" - 'Next - 'rstr = $"{rstr},{PortTable.Cell(i, 4).Tag}" - Console.WriteLine("PortTable.Cell(i, 4).Text:" & PortTable.Cell(i, 4).Text) - rstr = $"{PortTable.Cell(i, 2).Text}" + ' rstr = $"{rstr},{PortTable.Cell(i, j).Text}" + 'Next + 'rstr = $"{rstr},{PortTable.Cell(i, 4).Tag}" + rstr = $"{PortTable.Cell(i, 2).Text}" + If ParseDevDic.ContainsKey(rstr) Then + Dim indexd = ParseDevDic.Item(rstr) + rstr = $"{PortTable.Cell(i, 1).Text},{rstr},{PortTable.Cell(i, 3).Text},{PortTable.Cell(i, 4).Text},{indexd.Keys(0)},{indexd.Values(0).Keys(0)},{indexd.Values(0).Values(0).Item(0).Item1 }" + Else + ' Continue For + End If + 'rstr = rstr.Remove(0, 1) + 'deleteG_TableGridService(NoCardNode.Nodes(i - 1)) + NoCardNode.Nodes(i - 1).Description = rstr + Next + Else + For i = 1 To PortTable.Rows - 1 + rstr = String.Empty + 'For j = 1 To PortTable.Cols - 1 + + ' rstr = $"{rstr},{PortTable.Cell(i, j).Text}" + 'Next + 'rstr = $"{rstr},{PortTable.Cell(i, 4).Tag}" + rstr = $"{PortTable.Cell(i, 2).Text}" + If ParseDevDic.ContainsKey(rstr) Then + Dim indexd = ParseDevDic.Item(rstr) + rstr = $"{PortTable.Cell(i, 1).Text},{rstr},{PortTable.Cell(i, 3).Text},{PortTable.Cell(i, 4).Text},{PortTable.Cell(i, 5).Text},{PortTable.Cell(i, 6).Text},{PortTable.Cell(i, 7).Text},{indexd.Keys(0)},{indexd.Values(0).Keys(0)},{indexd.Values(0).Values(0).Item(0).Item1 }" + Else + ' Continue For + End If + 'rstr = rstr.Remove(0, 1) + 'deleteG_TableGridService(NoCardNode.Nodes(i - 1)) + NoCardNode.Nodes(i - 1).Description = rstr + Next + End If - If ParseDevDic.ContainsKey(rstr) Then - Dim indexd = ParseDevDic.Item(rstr) - rstr = $"{PortTable.Cell(i, 1).Text},{rstr},{PortTable.Cell(i, 3).Text},{PortTable.Cell(i, 4).Text},{indexd.Keys(0)},{indexd.Values(0).Keys(0)},{indexd.Values(0).Values(0).Item(0).Item1 }" - Else - ' Continue For - End If - 'rstr = rstr.Remove(0, 1) - NoCardNode.Nodes(i - 1).Description = rstr - Next Return True End Function @@ -94,6 +285,7 @@ Public Class PowerSupply Dim headname As CtabRange Dim keystr As String = String.Empty Dim li As List(Of String) + Dim cra As CtabRange For i = 1 To IfGrid.Rows - 1 headname = New CtabRange(IfGrid, i, 1) ' IfGrid.Cell(i, 1).Tag If rstr.ContainsKey(headname.devname) Then @@ -107,7 +299,19 @@ Public Class PowerSupply 'If IfGrid.Column(j).Locked Then ' Continue For 'End If - keystr = $"{keystr},{IfGrid.Cell(i, j).Text}" + + If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then + keystr = $"{keystr},{IfGrid.Cell(i, j).Text}" + Else + If j > 17 Then + cra = New CtabRange(IfGrid, i, j) + keystr = $"{keystr},{cra.devname}" + Else + keystr = $"{keystr},{IfGrid.Cell(i, j).Text}" + End If + + End If + Next keystr = keystr.Remove(0, 1) li.Add(keystr) @@ -118,6 +322,45 @@ Public Class PowerSupply Return True End Function + '条件检查 + Public Function ConditionCheck() As Integer + 'Console.WriteLine(IfGrid.Cell(IfGrid.Rows - 1, 3).Text) + If Not IfGrid.Cell(IfGrid.Rows - 1, 3).Text.Trim.Equals("From fullness to emptiness") Then + Return 1 + End If + Dim headname As CtabRange + Dim duanli, duanliindex As Integer + + '判断brief absence是否只有一组且条件数据量大于1 + For i = 1 To IfGrid.Rows - 1 + headname = New CtabRange(IfGrid, i, 1) + + If IfGrid.Cell(headname.fr, 3).Text.Trim.Equals("brief absence") Then + duanli = duanli + 1 + 'If duanli > 1 Then + ' Return 2 + 'End If + 'If headname.lr - headname.fr < 1 Then + ' Return 3 + 'End If + End If + + + + 'If IfGrid.Cell(headname.fr, 3).Text.Trim.Equals("Long absence") Then + ' duanli = duanli + 1 + ' If duanli > 1 Then + ' Return 4 + ' End If + 'End If + + + i = headname.lr + Next + + Return 0 + End Function + Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress '数字0~9所对应的keychar为48~57 @@ -128,27 +371,46 @@ Public Class PowerSupply End If End Sub - + Public Isoneload As Boolean = False Private Sub PowerSupply_Load(sender As Object, e As EventArgs) Handles MyBase.Load - CheckBox2.Checked = False - CheckBox1.Enabled = False - CheckBox2.Enabled = False - If IsNothing(NoCardNode) Then - CheckBox2.Checked = True - CheckBox1.Checked = False - Else - CheckBox2.Checked = False - CheckBox1.Checked = True - InitIfGrid(UniqueDevice.Desc.DevDescription) - InitPortTable(NoCardNode) - NR_ComboBox1.SelectedIndex = 1 - GetDevDescription() + If IsNothing(NoCardNode) Then + + Else + + If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then + InitIfGrid(UniqueDevice.Desc.DevDescription) + InitPortTable(NoCardNode) + NR_ComboBox1.SelectedIndex = 1 + ComboBox1.SelectedIndex = 1 + GetDevDescription() + SetControlHiding(True) + Else + Isoneload = False + SetControlHiding(False) + InitIfGrid1(UniqueDevice.Desc.DevDescription) + InitPortTable1(NoCardNode) + Isoneload = True + End If End If End Sub + '设置控件隐藏或显示 + Public Sub SetControlHiding(ishide As Boolean) + CheckBox3.Visible = ishide + CheckBox5.Visible = ishide + CheckBox6.Visible = ishide + CheckBox4.Visible = ishide + NR_label3.Visible = ishide + Label5.Visible = ishide + TextBox2.Visible = ishide + NR_TextBox2.Visible = ishide + NR_ComboBox1.Visible = ishide + ComboBox1.Visible = ishide + End Sub + #Region “初始化表格“ Private UniqueDevice As DeviceModel @@ -424,6 +686,104 @@ Public Class PowerSupply Next isxiugai1 = True End Sub + Public Sub InitPortTable1(Node As DeviceChildNodeClass) + PortTable.NewFile() + PortTable.ExtendLastCol = False + PortTable.Cols = 8 + PortTable.Rows = Node.Nodes.Count + 1 + PortTable.Cell(0, 0).Text = "Port" + PortTable.Cell(0, 1).Text = "Alias" + PortTable.Cell(0, 2).Text = "Input Port (Set input loop alias on homepage first)" + PortTable.Cell(0, 3).Text = "Unoccupied→Occupied Threshold (%)" + PortTable.Cell(0, 4).Text = "Occupied→Unoccupied Threshold (%)" + PortTable.Cell(0, 5).Text = "Enable" + PortTable.Cell(0, 6).Text = "Detection Time" + PortTable.Cell(0, 7).Text = "Detection Time Unit" + + + PortTable.Row(0).Locked = True + PortTable.Column(0).Width = 100 + PortTable.Column(1).Width = 80 + PortTable.Column(2).Width = 250 + PortTable.Column(3).Width = 150 + PortTable.Column(4).Width = 150 + PortTable.Column(5).Width = 30 + PortTable.Column(6).Width = 60 + PortTable.Column(7).Width = 80 + + ' PortTable.Column(1).CellType = FlexCell.CellTypeEnum.ComboBox + PortTable.Column(2).CellType = FlexCell.CellTypeEnum.ComboBox + PortTable.Column(3).CellType = FlexCell.CellTypeEnum.ComboBox + PortTable.Column(4).CellType = FlexCell.CellTypeEnum.ComboBox + PortTable.Column(5).CellType = FlexCell.CellTypeEnum.CheckBox + PortTable.Column(6).CellType = FlexCell.CellTypeEnum.ComboBox + PortTable.Column(7).CellType = FlexCell.CellTypeEnum.ComboBox + + ''PortTable.Column(1).Locked = True + 'PortTable.ComboBox(2).Locked = True + 'PortTable.ComboBox(3).Locked = True + 'PortTable.ComboBox(4).Locked = True + ''PortTable.ComboBox(5).Locked = True + 'PortTable.ComboBox(6).Locked = True + 'PortTable.ComboBox(7).Locked = True + + PortTable.Column(0).Alignment = FlexCell.AlignmentEnum.CenterCenter + PortTable.Column(1).Alignment = FlexCell.AlignmentEnum.CenterCenter + PortTable.Column(2).Alignment = FlexCell.AlignmentEnum.CenterCenter + PortTable.Column(3).Alignment = FlexCell.AlignmentEnum.CenterCenter + PortTable.Column(7).Alignment = FlexCell.AlignmentEnum.CenterCenter + PortTable.Column(4).Alignment = FlexCell.AlignmentEnum.CenterCenter + PortTable.Column(5).Alignment = FlexCell.AlignmentEnum.CenterCenter + PortTable.Column(6).Alignment = FlexCell.AlignmentEnum.CenterCenter + + + isxiugai1 = False + Dim sbuf() As String + For i = 1 To Node.Nodes.Count + PortTable.Cell(i, 1).Text = " " + PortTable.Cell(i, 0).Text = Node.Nodes(i - 1).Name + sbuf = Node.Nodes(i - 1).Description.Split(",") + If sbuf.Length = 10 Then + If String.IsNullOrEmpty(sbuf(0).Trim) Then + PortTable.Cell(i, 1).Text = GetPortName(i) + Else + PortTable.Cell(i, 1).Text = sbuf(0) + End If + + PortTable.Cell(i, 2).Text = sbuf(1) + PortTable.Cell(i, 3).Text = sbuf(2) + PortTable.Cell(i, 4).Text = sbuf(3) + PortTable.Cell(i, 5).Text = sbuf(4) + PortTable.Cell(i, 6).Text = sbuf(5) + PortTable.Cell(i, 7).Text = sbuf(6) + 'If i = 2 Or i = 3 Then + ' PortTable.Cell(i, 4).Locked = True + ' PortTable.Cell(i, 3).Locked = True + 'End If + Else + PortTable.Cell(i, 1).Text = GetPortName(i) + PortTable.Cell(i, 3).Text = 0 + PortTable.Cell(i, 4).Text = 0 + PortTable.Cell(i, 5).Text = 0 + PortTable.Cell(i, 6).Text = 0 + PortTable.Cell(i, 7).Text = "s" + 'If i < 4 Then + ' PortTable.Cell(i, 3).Text = 0 + ' If i = 2 Or i = 3 Then + ' PortTable.Cell(i, 4).Locked = True + ' PortTable.Cell(i, 3).Locked = True + ' End If + 'Else + + 'PortTable.Cell(i, 3).Text = 50 + 'If i = 6 Then + ' PortTable.Cell(i, 3).Text = 10 + ' End If + 'End If + End If + Next + isxiugai1 = True + End Sub Public Function GetPortName(rowindex As Integer) Dim result As String = String.Empty Select Case rowindex @@ -431,7 +791,7 @@ Public Class PowerSupply Case 1 result = "Insert card" Case 2 - result = "Open door contact" + result = "Open contact" Case 3 result = "Doorway infrared" Case 4 @@ -964,6 +1324,548 @@ Public Class PowerSupply End Sub + Public Sub InitIfGrid1(jsonstr As String, Optional ifbn As Boolean = True) + IfGrid.NewFile() + IfGrid.ExtendLastCol = False + IfGrid.Cols = 20 + IfGrid.Rows = 1 + + IfGrid.Cell(0, 1).Text = "Condition Group" + IfGrid.Cell(0, 2).Text = "Condition No" + IfGrid.Cell(0, 3).Text = "Occupancy Flag" + IfGrid.Cell(0, 4).Text = "Port 1" + IfGrid.Cell(0, 5).Text = "Port 2" + IfGrid.Cell(0, 6).Text = "Port 3" + IfGrid.Cell(0, 7).Text = "Port 4" + IfGrid.Cell(0, 8).Text = "Port 5" + IfGrid.Cell(0, 9).Text = "Port 6" + IfGrid.Cell(0, 10).Text = "Port 7" + IfGrid.Cell(0, 11).Text = "Port 8" + IfGrid.Cell(0, 12).Text = "Port 9" + IfGrid.Cell(0, 13).Text = "Port 10" + IfGrid.Cell(0, 14).Text = "Port 11" + IfGrid.Cell(0, 15).Text = "Trigger Threshold" + IfGrid.Cell(0, 16).Text = "Sustained Judgment Time" + IfGrid.Cell(0, 17).Text = "Sustained Judgment Time Unit" + IfGrid.Cell(0, 18).Text = "Condition Group Timeout" + IfGrid.Cell(0, 19).Text = "Condition Group Timeout Unit" + + + IfGrid.Column(3).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(4).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(5).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(6).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(7).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(8).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(9).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(10).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(11).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(12).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(13).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(14).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(15).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(16).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(17).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(18).CellType = FlexCell.CellTypeEnum.ComboBox + IfGrid.Column(19).CellType = FlexCell.CellTypeEnum.ComboBox + + IfGrid.Column(0).Width = 0 + IfGrid.Column(1).Width = 50 + IfGrid.Column(2).Width = 60 + IfGrid.Column(3).Width = 60 + IfGrid.Column(4).Width = 60 + IfGrid.Column(5).Width = 60 + IfGrid.Column(6).Width = 60 + IfGrid.Column(7).Width = 60 + IfGrid.Column(8).Width = 60 + IfGrid.Column(9).Width = 60 + IfGrid.Column(10).Width = 60 + IfGrid.Column(11).Width = 60 + IfGrid.Column(12).Width = 60 + IfGrid.Column(13).Width = 60 + IfGrid.Column(14).Width = 60 + IfGrid.Column(15).Width = 60 + IfGrid.Column(16).Width = 60 + IfGrid.Column(17).Width = 60 + IfGrid.Column(18).Width = 60 + IfGrid.Column(19).Width = 60 + + IfGrid.Column(0).Visible = True + 'IfGrid.Column(1).Locked = True + 'IfGrid.Column(2).Locked = True + 'IfGrid.ComboBox(3).Locked = True + 'IfGrid.ComboBox(5).Locked = True + 'IfGrid.ComboBox(6).Locked = True + 'IfGrid.ComboBox(7).Locked = True + 'IfGrid.ComboBox(11).Locked = True + 'IfGrid.ComboBox(12).Locked = True + 'IfGrid.ComboBox(4).Locked = True + 'IfGrid.ComboBox(8).Locked = True + 'IfGrid.ComboBox(9).Locked = True + 'IfGrid.ComboBox(10).Locked = True + 'IfGrid.ComboBox(13).Locked = True + 'IfGrid.ComboBox(14).Locked = True + 'IfGrid.ComboBox(15).Locked = True + 'IfGrid.ComboBox(16).Locked = True + 'IfGrid.ComboBox(17).Locked = True + 'IfGrid.ComboBox(18).Locked = True + 'IfGrid.ComboBox(19).Locked = True + + IfGrid.Column(0).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(1).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(2).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(3).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(4).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(5).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(6).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(7).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(8).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(9).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(10).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(11).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(12).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(13).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(14).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(15).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(16).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(17).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(18).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(19).Alignment = FlexCell.AlignmentEnum.CenterCenter + IfGrid.Column(15).Visible = False + ' IfGrid.Column(18).Visible = False + Try + Dim startrow As Integer = 0 + IfGridRowdic = JsonConvert.DeserializeObject(Of Dictionary(Of String, List(Of String)))(jsonstr) + If IsNothing(IfGridRowdic) OrElse IfGridRowdic.Count < 1 Then + BuildTableRow1() + + Else + Dim headrow As Integer + For Each node In IfGridRowdic + IfGrid.AddItem("") + + headrow = IfGrid.Rows - 1 + + For i = 0 To node.Value.Count - 1 + If i = 0 Then + Else + IfGrid.AddItem("") + End If + IfGrid.Cell(IfGrid.Rows - 1, 1).Text = $"{node.Key}" + IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = $"{node.Key}" + Dim rowstr() As String = node.Value(i).Split(",") + + For j = 1 To rowstr.Length + If ifbn Then + IfGrid.Cell(IfGrid.Rows - 1, j + 1).Text = rowstr(j - 1) + Else + If j = rowstr.Length Then Continue For + + IfGrid.Cell(IfGrid.Rows - 1, j + 1).Text = rowstr(j) + End If + + Next + + Next + If headrow < IfGrid.Rows - 1 Then + IfGrid.Column(1).Locked = False + IfGrid.Range(headrow, 1, IfGrid.Rows - 1, 1).Merge() + IfGrid.Range(headrow, 18, IfGrid.Rows - 1, 18).Merge() + IfGrid.Range(headrow, 19, IfGrid.Rows - 1, 19).Merge() + IfGrid.Column(1).Locked = True + End If + + Next + End If + Catch ex As Exception + BuildTableRow1() + + End Try + + End Sub + Public Sub BuildTableRow1() + IfGridRowdic = New Dictionary(Of String, List(Of String)) + + + + IfGrid.AddItem("") + IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 1 + IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1 + IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Close to Open" + IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"2" + IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"s" + + + IfGrid.AddItem("") + IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 2 + IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1 + IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From fullness to emptiness" + IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Open to Close" + IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"2" + IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"s" + + + + IfGrid.AddItem("") + Dim startR As Integer = IfGrid.Rows - 1 + IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1 + IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From fullness to emptiness" + IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Close" + IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Release" + IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"5" + IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"m" + IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 2 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"trigger" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"trigger" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 4 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"trigger" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 5 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"trigger" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 6 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"trigger" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 7 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"trigger" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 8 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"trigger" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 9 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"trigger" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.Column(1).Locked = False + 'IfGrid.Range(startR, 1, IfGrid.Rows - 1, 1).Merge() + 'IfGrid.Range(startR, 18, IfGrid.Rows - 1, 18).Merge() + 'IfGrid.Range(startR, 19, IfGrid.Rows - 1, 19).Merge() + 'IfGrid.Column(1).Locked = True + + + + + 'IfGrid.AddItem("") + 'startR = IfGrid.Rows - 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 4 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "brief absence" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Open to Close" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 5 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 2 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "brief absence" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Close" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + ''IfGrid.Column(1).Locked = False + ''IfGrid.Range(startR, 1, IfGrid.Rows - 1, 1).Merge() + ''IfGrid.Range(startR, 18, IfGrid.Rows - 1, 18).Merge() + ''IfGrid.Range(startR, 19, IfGrid.Rows - 1, 19).Merge() + ''IfGrid.Column(1).Locked = True + + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 6 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "Long absence" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Open" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + 'IfGrid.AddItem("") + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 7 + 'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1 + 'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From fullness to emptiness" + 'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" + 'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Open" + 'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Release" + 'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + 'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + 'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + 'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + + IfGridRowdic.Clear() + Dim headname As CtabRange + Dim keystr As String = String.Empty + Dim li As List(Of String) + For i = 1 To IfGrid.Rows - 1 + headname = New CtabRange(IfGrid, i, 1) ' IfGrid.Cell(i, 1).Tag + If IfGridRowdic.ContainsKey(headname.devname) Then + li = IfGridRowdic.Item(headname.devname) + Else + li = New List(Of String) + IfGridRowdic.Add(headname.devname, li) + End If + + For j = 2 To IfGrid.Cols - 1 + 'If IfGrid.Column(j).Locked Then + ' Continue For + 'End If + keystr = $"{keystr},{IfGrid.Cell(i, j).Text}" + Next + + keystr = keystr.Remove(0, 1) + li.Add(keystr) + keystr = String.Empty + Next + End Sub + + Private Sub PortTable_ComboDropDown(Sender As Object, e As FlexCell.Grid.ComboDropDownEventArgs) Handles PortTable.ComboDropDown Dim headname As String = PortTable.Cell(0, e.Col).Text @@ -998,11 +1900,19 @@ Public Class PowerSupply 'PortTable.Cell(e.Row, 1).Text = - Case 3 + Case 3, 4 PortTable.ComboBox(e.Col).Items.Clear() For i = 0 To 100 PortTable.ComboBox(e.Col).Items.Add(i) Next + Case 6 + PortTable.ComboBox(e.Col).Items.Clear() + For i = 0 To 255 + PortTable.ComboBox(e.Col).Items.Add(i) + Next + Case 7 + PortTable.ComboBox(e.Col).Items.Clear() + PortTable.ComboBox(e.Col).Items.AddRange({"s", "m", "h"}) End Select End Sub @@ -1011,17 +1921,20 @@ Public Class PowerSupply Dim headname As String = IfGrid.Cell(0, e.Col).Text If e.Col = 3 Then IfGrid.ComboBox(e.Col).Items.Clear() - IfGrid.ComboBox(e.Col).Items.AddRange({"From emptiness to fullness", "From fullness to emptiness"}) - ElseIf e.Col > 3 AndAlso e.Col < 15 Then + IfGrid.ComboBox(e.Col).Items.AddRange({"From emptiness to fullness", "From fullness to emptiness", "brief absence", "Long absence"}) + ElseIf e.Col = 5 Then + IfGrid.ComboBox(e.Col).Items.Clear() + IfGrid.ComboBox(e.Col).Items.AddRange({"Not judging", "Open", "Close", "Close to Open", "Open to Close"}) + ElseIf e.Col = 4 OrElse (e.Col >= 6 AndAlso e.Col < 15) Then IfGrid.ComboBox(e.Col).Items.Clear() IfGrid.ComboBox(e.Col).Items.AddRange({"Not judging", "trigger", "Release"}) - ElseIf e.Col = 15 Then + ElseIf e.Col = 15 OrElse e.Col = 16 OrElse e.Col = 18 Then IfGrid.ComboBox(e.Col).Items.Clear() For i = 0 To 255 IfGrid.ComboBox(e.Col).Items.Add(i) Next - ElseIf e.Col = 16 Then + ElseIf e.Col = 17 OrElse e.Col = 19 Then IfGrid.ComboBox(e.Col).Items.Clear() IfGrid.ComboBox(e.Col).Items.AddRange({"s", "m", "h"}) End If @@ -1065,6 +1978,11 @@ Public Class PowerSupply Next IfGrid.Column(1).Locked = False IfGrid.Range(inrow, 1, inrow + 1, 1).Merge() + If IfGrid.Cols > 19 Then + IfGrid.Range(inrow, 18, inrow + 1, 18).Merge() + IfGrid.Range(inrow, 19, inrow + 1, 19).Merge() + End If + IfGrid.Column(1).Locked = True nodestr = nodestr.Remove(0, 1) @@ -1125,7 +2043,7 @@ Public Class PowerSupply IfGrid.Cell(IfGrid.Rows - 1, 1).Text = $"{i}" IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = $"{i}" IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1 - IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From emptiness to fullness" + IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "From fullness to emptiness" IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Not judging" IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"Not judging" @@ -1137,65 +2055,232 @@ Public Class PowerSupply IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"Not judging" IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"Not judging" IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"Not judging" - IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" - IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"s" - li.Add($"{i},1,1,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,0,s") + If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then + IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"s" + li.Add($"{i},1,1,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,0,s") + Else + IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0" + IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0" + IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"s" + IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10" + IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"m" + li.Add($"{i},1,1,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,0,0,s,10,m") + End If + IfGridRowdic.Add(i, li) End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click + If IfGrid.ActiveCell.Row = 1 AndAlso IfGrid.Rows = 2 Then + MsgBox("At least keep one condition!") + Return + End If Dim headname As CtabRange = New CtabRange(IfGrid, IfGrid.ActiveCell.Row, 1) Dim number As Integer = 0 Dim number1 As Integer = 1 Dim frow As CtabRange + Dim li As List(Of String) = New List(Of String) For i = headname.fr To headname.lr IfGrid.Row(headname.lr - number).Delete() number = number + 1 Next - + If IfGridRowdic.ContainsKey(headname.devname) Then + IfGridRowdic.Remove(headname.devname) + End If + If headname.fr = 1 Then + IfGrid.Cell(headname.fr, headname.fc).Text = 1 + li = IfGridRowdic.Item(2) + IfGridRowdic.Remove(2) + IfGridRowdic.Add(1, li) + End If For i = 2 To IfGrid.Rows - 1 headname = New CtabRange(IfGrid, i, 1) frow = New CtabRange(IfGrid, i - 1, 1) If (CInt(headname.devname) - CInt(frow.devname) > 1) Then number1 = CInt(headname.devname) IfGrid.Cell(headname.fr, headname.fc).Text = (CInt(frow.devname) + 1) + li = IfGridRowdic.Item(headname.devname) + '删除 + IfGridRowdic.Remove(headname.devname) + '添加 + IfGridRowdic.Add((CInt(frow.devname) + 1), li) Else End If Next GetIfTable() - InitIfGrid(UniqueDevice.Desc.DevDescription) + If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then + InitIfGrid(UniqueDevice.Desc.DevDescription) + Else + Isoneload = False + InitIfGrid1(UniqueDevice.Desc.DevDescription) + Isoneload = True + End If + End Sub + Public IsnotCellChange As Boolean Private Sub IfGrid_CellChange(Sender As Object, e As FlexCell.Grid.CellChangeEventArgs) Handles IfGrid.CellChange + If e.Row = 0 Then Return Dim celltext As String = IfGrid.Cell(e.Row, e.Col).Text If celltext.Contains("From emptiness to fullness") Then IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Blue - ElseIf celltext.Contains("From fullness to emptiness") Then + + If IsnotCellChange Then Return + IsnotCellChange = True + Dim ta As CtabRange + ta = New CtabRange(IfGrid, e.Row, 1) + For i = ta.fr To ta.lr + IfGrid.Cell(i, e.Col).Text = "From emptiness to fullness" + Next + IsnotCellChange = False + + ElseIf celltext.Contains("From fullness to emptiness") Then IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Orange - ElseIf celltext.Contains("Release") Then + + If IsnotCellChange Then Return + IsnotCellChange = True + Dim ta As CtabRange + ta = New CtabRange(IfGrid, e.Row, 1) + For i = ta.fr To ta.lr + IfGrid.Cell(i, e.Col).Text = "From fullness to emptiness" + Next + IsnotCellChange = False + + ElseIf celltext.Contains("brief absence") Then + IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Brown + If IsnotCellChange Then Return + IsnotCellChange = True + Dim ta As CtabRange + ta = New CtabRange(IfGrid, e.Row, 1) + For i = ta.fr To ta.lr + IfGrid.Cell(i, e.Col).Text = "brief absence" + Next + '从ta.fr 行往第一行查找 + For i = ta.fr To 1 Step -1 + If IfGrid.Cell(i, e.Col).Text.Trim.Equals("Long absence") OrElse IfGrid.Cell(i, e.Col).Text.Trim.Equals("From fullness to emptiness") Then + IfGrid.Cell(i, e.Col).Text = "brief absence" + End If + Next + If Isoneload Then + If ta.lr = IfGrid.Rows - 1 Then + MsgBox("A brief absence should not be taken as the final line. Please use 'With someone present, there is no one absent' as the final line!") + Return + End If + End If + + For i = ta.lr To IfGrid.Rows - 1 + If IfGrid.Cell(i, e.Col).Text.Trim.Equals("From emptiness to fullness") Then + IfGrid.Cell(i, e.Col).Text = "From fullness to emptiness" + End If + Next + + + + IsnotCellChange = False + + ElseIf celltext.Contains("Long absence") Then + IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Violet + If IsnotCellChange Then Return + IsnotCellChange = True + Dim ta As CtabRange + ta = New CtabRange(IfGrid, e.Row, 1) + For i = ta.fr To ta.lr + IfGrid.Cell(i, e.Col).Text = "Long absence" + Next + '从ta.fr 行往第一行查找 + For i = ta.fr To 1 Step -1 + If IfGrid.Cell(i, e.Col).Text.Trim.Equals("From fullness to emptiness") Then + IfGrid.Cell(i, e.Col).Text = "Long absence" + End If + Next + If Isoneload Then + If ta.lr = IfGrid.Rows - 1 Then + MsgBox("Long-term absence should not be listed as the last item. Please use 'From someone to no one' as the last item!") + Return + End If + End If + + For i = ta.lr + 1 To IfGrid.Rows - 1 + If IfGrid.Cell(i, e.Col).Text.Trim.Equals("brief absence") OrElse IfGrid.Cell(i, e.Col).Text.Trim.Equals("From emptiness to fullness") OrElse IfGrid.Cell(i, e.Col).Text.Trim.Equals("Long absence") Then + IfGrid.Cell(i, e.Col).Text = "From fullness to emptiness" + End If + Next + IsnotCellChange = False + + ElseIf celltext.Contains("Release") OrElse celltext.Contains("Open") Then IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Green ElseIf celltext.Contains("Not judging") Then IfGrid.Cell(e.Row, e.Col).ForeColor = Color.LightGray - ElseIf celltext.Contains("trigger") Then + ElseIf celltext.Contains("trigger") OrElse celltext.Contains("Close") Then IfGrid.Cell(e.Row, e.Col).ForeColor = Color.OrangeRed + ElseIf celltext.Contains("Close to Open") Then + IfGrid.Cell(e.Row, e.Col).ForeColor = Color.MediumVioletRed + ElseIf celltext.Contains("Open to Close") Then + IfGrid.Cell(e.Row, e.Col).ForeColor = Color.LightGreen + End If + + If e.Col > 15 AndAlso Not UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then + Dim na, nb As CtabRange + na = New CtabRange(IfGrid, e.Row, 18) + nb = New CtabRange(IfGrid, e.Row, 19) + If String.IsNullOrEmpty(IfGrid.Cell(e.Row, 16).Text) OrElse + String.IsNullOrEmpty(IfGrid.Cell(e.Row, 17).Text) OrElse + String.IsNullOrEmpty(na.devname) OrElse String.IsNullOrEmpty(nb.devname) Then + Else + Dim ct, nt As Double + IfGrid.Cell(e.Row, 16).BackColor = Color.White + IfGrid.Cell(e.Row, 17).BackColor = Color.White + IfGrid.Cell(e.Row, 18).BackColor = Color.White + IfGrid.Cell(e.Row, 19).BackColor = Color.White + ct = GetTableTimeUnit(IfGrid.Cell(e.Row, 16).Text, IfGrid.Cell(e.Row, 17).Text) + nt = GetTableTimeUnit(na.devname, nb.devname) + If nt = 0 Then + MsgBox("The timeout time for the condition group cannot be 0!") + IfGrid.Cell(e.Row, e.Col).BackColor = Color.OrangeRed + Return + End If + If ct > nt Then + MsgBox("The condition delay time cannot be longer than the timeout time of the condition group!") + IfGrid.Cell(e.Row, e.Col).BackColor = Color.OrangeRed + Return + End If + End If End If - End Sub + + '将h间单位转换为s、 + Public Function GetTableTimeUnit(ntime As String, timeunit As String) As Integer + If ntime.Equals("") OrElse timeunit.Equals("") Then Return 0 + '判断时间单位是 时、m、s + If timeunit.Equals("h") Then + Return CInt(ntime) * 3600 + ElseIf timeunit.Equals("m") Then + Return CInt(ntime) * 60 + ElseIf timeunit.Equals("s") Then + Return CInt(ntime) + End If + End Function + Public Shared Function GetNoCarDataKeyVal(keystr As String) As Integer If keystr.Contains("From emptiness to fullness") Then Return 1 - ElseIf keystr.Contains("From fullness to emptiness") Then + ElseIf keystr.Contains("From fullness to emptiness") Then Return 2 - ElseIf keystr.Contains("Release") Then + ElseIf keystr.Contains("Release") OrElse keystr.Contains("Open") Then Return 2 ElseIf keystr.Contains("Not judging") Then Return 0 - ElseIf keystr.Contains("trigger") Then + ElseIf keystr.Contains("trigger") OrElse keystr.Contains("Close") Then Return 1 + ElseIf keystr.Contains("Close to Open") OrElse keystr.Contains("Long absence") Then + Return 4 + ElseIf keystr.Contains("Open to Close") OrElse keystr.Contains("brief absence") Then + Return 3 End If Return 0 @@ -1213,6 +2298,7 @@ Public Class PowerSupply End Sub Public maxdelayed As Integer = 10 + Public maxdelayed1 As Integer = 10 Private Sub NR_ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles NR_ComboBox1.SelectedIndexChanged If NR_ComboBox1.Text.Equals("h") Then maxdelayed = 12 @@ -1220,13 +2306,32 @@ Public Class PowerSupply maxdelayed = 600 End If End Sub + Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged + If NR_ComboBox1.Text.Equals("h") Then + maxdelayed1 = 12 + Else + maxdelayed1 = 600 + End If + End Sub Private Sub NR_TextBox2_TextChanged(sender As Object, e As EventArgs) Handles NR_TextBox2.TextChanged + If String.IsNullOrEmpty(NR_TextBox2.Text) Then + NR_TextBox2.Text = 10 + End If Dim tint As Integer = CInt(NR_TextBox2.Text) If tint > maxdelayed Then NR_TextBox2.Text = maxdelayed End If End Sub + Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged + If String.IsNullOrEmpty(TextBox2.Text) Then + TextBox2.Text = 10 + End If + Dim tint As Integer = CInt(TextBox2.Text) + If tint > maxdelayed1 Then + TextBox2.Text = maxdelayed1 + End If + End Sub Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) @@ -1266,17 +2371,232 @@ Public Class PowerSupply End If Next - - - - - - - Next End Sub + Private Sub IfGrid_KeyDown(Sender As Object, e As KeyEventArgs) Handles IfGrid.KeyDown + + If e.Control AndAlso e.KeyCode = Keys.C Then + e.Handled = True '抑制系统蜂鸣 + CopySelectedCells() + End If + If e.Control AndAlso e.KeyCode = Keys.V Then + e.Handled = True + PasteClipboardToDGV() + End If + End Sub + + Public Sub PasteClipboardToDGV() + '粘贴剪贴板内容到表格中 + If Not Clipboard.ContainsText() Then Return + Dim sb As New System.Text.StringBuilder + Dim lines() As String = Clipboard.GetText().Split(ControlChars.CrLf) + Dim minRow As Integer = IfGrid.ActiveCell.Row + Dim minCol As Integer = IfGrid.ActiveCell.Col + + '判断数据是否超出表格范围 + If minRow + lines.Length > IfGrid.Rows OrElse minCol + lines(0).Split(ControlChars.Tab).Length > IfGrid.Cols Then + MsgBox("The data exceeds the range of the table.") + Return + End If + If minCol = 1 OrElse minCol = 2 Then + MsgBox("Cannot be pasted into the condition group or condition number.") + Return + End If + + Dim rag As Range + Dim cells() As String = lines(0).Split(ControlChars.Tab) + Dim rowint As Integer = 0 + '判断首列是否是同一列 + If minCol.ToString.Equals(cells(0)) Then '首列相同 + For i As Integer = 1 To lines.Length - 1 + + cells = lines(i).Split(ControlChars.Tab) + rowint = minRow + i - 1 + For j As Integer = 0 To cells.Length - 1 + If IfGrid.Column(minCol + j).Visible Then + '判断是否在范围内 + If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then + rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j) + '判断是否为合并单元格 + IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + ' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + End If + + 'i = rag.LastRow - minRow + 'j = rag.LastCol - minCol + End If + Next + Next + Else '首列不同 + Dim vcint As Integer = 0 + Integer.TryParse(cells(0), vcint) + + If minCol = 4 AndAlso cells.Length = 1 AndAlso vcint > 6 AndAlso vcint < 16 Then '第二列相同 + For i As Integer = 1 To lines.Length - 1 + + cells = lines(i).Split(ControlChars.Tab) + rowint = minRow + i - 1 + For j As Integer = 0 To cells.Length - 1 + If IfGrid.Column(minCol + j).Visible Then + '判断是否在范围内 + If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then + rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j) + '判断是否为合并单元格 + IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + ' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + End If + + 'i = rag.LastRow - minRow + 'j = rag.LastCol - minCol + End If + Next + Next + ElseIf minCol > 6 AndAlso minCol < 16 AndAlso cells.Length = 1 AndAlso vcint = 4 Then + For i As Integer = 1 To lines.Length - 1 + + cells = lines(i).Split(ControlChars.Tab) + rowint = minRow + i - 1 + For j As Integer = 0 To cells.Length - 1 + If IfGrid.Column(minCol + j).Visible Then + '判断是否在范围内 + If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then + rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j) + '判断是否为合并单元格 + IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + ' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + End If + + 'i = rag.LastRow - minRow + 'j = rag.LastCol - minCol + End If + Next + Next + ElseIf minCol > 6 AndAlso minCol < 16 AndAlso vcint + cells.Length > 6 AndAlso vcint + cells.Length < 16 Then + For i As Integer = 1 To lines.Length - 1 + + cells = lines(i).Split(ControlChars.Tab) + rowint = minRow + i - 1 + For j As Integer = 0 To cells.Length - 1 + If IfGrid.Column(minCol + j).Visible Then + '判断是否在范围内 + If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then + rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j) + '判断是否为合并单元格 + IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + ' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + End If + + 'i = rag.LastRow - minRow + 'j = rag.LastCol - minCol + End If + Next + Next + + ElseIf minCol = 16 AndAlso vcint = 18 Then + For i As Integer = 1 To lines.Length - 1 + + cells = lines(i).Split(ControlChars.Tab) + rowint = minRow + i - 1 + For j As Integer = 0 To cells.Length - 1 + If IfGrid.Column(minCol + j).Visible Then + '判断是否在范围内 + If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then + rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j) + '判断是否为合并单元格 + IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + ' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + End If + + 'i = rag.LastRow - minRow + 'j = rag.LastCol - minCol + End If + Next + Next + + ElseIf (minCol = 18 AndAlso vcint = 16) Then + For i As Integer = 1 To lines.Length - 1 + + cells = lines(i).Split(ControlChars.Tab) + rowint = minRow + i - 1 + For j As Integer = 0 To cells.Length - 1 + If IfGrid.Column(minCol + j).Visible Then + '判断是否在范围内 + If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then + rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j) + '判断是否为合并单元格 + IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + ' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j) + End If + + 'i = rag.LastRow - minRow + 'j = rag.LastCol - minCol + End If + Next + Next + Else + MsgBox("The pasted data does not match the data type of the table.!") + Return + End If + + + + + + End If + + + + '将数据粘贴到表格中 + ' + + + + End Sub + + + + + Public Sub CopySelectedCells() + '获取表格中选中的单元格, 并复制到剪贴板 + Dim Selectioncell As Selection = IfGrid.Selection + Dim sb As New System.Text.StringBuilder + 'Dim sel = dgv.SelectedCells.Cast(Of DataGridViewCell)() + Dim minRow As Integer = Selectioncell.FirstRow + Dim maxRow As Integer = Selectioncell.LastRow + Dim minCol As Integer = Selectioncell.FirstCol + Dim maxCol As Integer = Selectioncell.LastCol + Dim includeHeader As Boolean = True + '2. 表头(可选) + If includeHeader Then + For c As Integer = minCol To maxCol + If IfGrid.Column(c).Visible Then + sb.Append(c.ToString()).Append(ControlChars.Tab) + End If + Next + sb.Length -= 1 '去掉最后一个 TAB + sb.AppendLine() + End If + Dim rag As Range + '3. 数据 + For r As Integer = minRow To maxRow + If IfGrid.Row(r).Visible Then '跳过隐藏行 + For c As Integer = minCol To maxCol + If IfGrid.Column(c).Visible Then '跳过隐藏列 + rag = IfGrid.Range(r, c, r, c) + sb.Append(IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text) + sb.Append(ControlChars.Tab) + End If + Next + sb.Length -= 1 '去掉行尾 TAB + sb.AppendLine() + End If + Next + + Clipboard.SetText(sb.ToString().TrimEnd()) + End Sub + diff --git a/BLV_Studio/Test/GridTest/TableInteraction.vb b/BLV_Studio/Test/GridTest/TableInteraction.vb index 8553b4c..864daec 100644 --- a/BLV_Studio/Test/GridTest/TableInteraction.vb +++ b/BLV_Studio/Test/GridTest/TableInteraction.vb @@ -2823,7 +2823,8 @@ Public Class TableInteraction For Each node In index.Nodes If node.Name.Equals("Virtual_Card") Then UniqueDevice = index - NoCardNode = node + NoCardNode = node + If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then vli = PortInformation(NoCardNode) nli = ConditionalInformation(UniqueDevice) mli = EquipmentCommonStats(UniqueDevice) @@ -2834,6 +2835,18 @@ Public Class TableInteraction result.Add(mli) End If End If + else + vli = PortInformation1(NoCardNode) + nli = ConditionalInformation1(UniqueDevice) + If Not IsNothing(vli) AndAlso vli.Count > 0 AndAlso Not IsNothing(vli) AndAlso vli.Count > 0 Then + result.AddRange(vli) + result.AddRange(nli) + + End If + End If + + + End If Next @@ -2864,6 +2877,7 @@ Public Class TableInteraction Dim sbuf() As String Dim isport As Boolean For Each node In NoCardNode.Nodes + 'If node.LoopAddr.Equals("1") Then Continue For '增加了跳过端口1的判断 sbuf = node.Description.Split(",") isport = True For i = 0 To sbuf.Length - 1 @@ -2873,7 +2887,28 @@ Public Class TableInteraction Next If isport AndAlso sbuf.Length > 4 Then result.Add(GetPortInformation(node.LoopAddr, node.Description)) + Else + Continue For + End If + Next + Return result + End Function + Public Function PortInformation1(NoCardNode As DeviceChildNodeClass) As List(Of Byte()) + Dim result As New List(Of Byte()) + Dim sbuf() As String + Dim isport As Boolean + For Each node In NoCardNode.Nodes + 'If node.LoopAddr.Equals("1") Then Continue For '增加了跳过端口1的判断 + sbuf = node.Description.Split(",") + isport = True + For i = 0 To sbuf.Length - 1 + If String.IsNullOrEmpty(sbuf(i)) AndAlso (i <> 2 AndAlso i <> 3) Then + isport = False + End If + Next + If isport AndAlso sbuf.Length > 4 Then + result.Add(GetPortInformation1(node.LoopAddr, node.Description)) Else Continue For End If @@ -2901,6 +2936,38 @@ Public Class TableInteraction Data.Add(1) End If Return Data.ToArray + End Function + Public Function GetPortInformation1(LoopAddr As String, nStr As String) As Byte() + Dim cmd As Byte = &H9 + Dim Data = New List(Of Byte) + Dim strbuf() As String = nStr.Split(",") + Data.Add(cmd) + Data.Add(CInt(strbuf(8))) + Data.Add(CInt(strbuf(9))) + Data.AddRange(BitConverter.GetBytes(CShort(CInt(strbuf(7))))) + If String.IsNullOrEmpty(strbuf(2)) Then + Data.Add(0) + Else + Data.Add(CInt(strbuf(2))) + End If + Data.Add(CInt(LoopAddr)) '- 1) '增加了减1 + If String.IsNullOrEmpty(strbuf(4)) OrElse strbuf(4).Equals("0") Then + Data.Add(0) + Else + Data.Add(1) + End If + if String.IsNullOrEmpty(strbuf(5)) OrElse strbuf(5).Equals("0") Then + Data.AddRange(BitConverter.GetBytes(CShort(0))) + Else + Data.AddRange(BitConverter.GetBytes(CShort(CInt(strbuf(5))))) + End If + Data.Add(GetGlossary8(strbuf(6))) + If String.IsNullOrEmpty(strbuf(3)) Then + Data.Add(0) + Else + Data.Add(CInt(strbuf(3))) + End If + Return Data.ToArray End Function Public Function ConditionalInformation(UniqueDevice As DeviceModel) As List(Of Byte()) Dim result As New List(Of Byte()) @@ -2931,6 +2998,56 @@ Public Class TableInteraction Next Next Return result + End Function + Public Function ConditionalInformation1(UniqueDevice As DeviceModel) As List(Of Byte()) + Dim result As New List(Of Byte()) + Dim sbuf() As String + Dim isport As Boolean + Dim IfGridRowdic As Dictionary(Of String, List(Of String)) + Try + IfGridRowdic = JsonConvert.DeserializeObject(Of Dictionary(Of String, List(Of String)))(UniqueDevice.Desc.DevDescription) + Catch ex As Exception + Return Nothing + End Try + + If IsNothing(IfGridRowdic) Then Return result + For Each index In IfGridRowdic + For Each node In index.Value + sbuf = node.Split(",") + isport = True + For Each nStr In sbuf + If String.IsNullOrEmpty(nStr) Then + isport = False + End If + Next + If isport AndAlso sbuf.Length > 3 Then + result.Add(GetConditionalInformation1(index.Key, node)) + Else + Continue For + End If + Next + Next + Return result + End Function + Public Function GetConditionalInformation1(key As String, nStr As String) As Byte() + Dim cmd As Byte = &H8 + Dim Data = New List(Of Byte) + Dim strbuf() As String = nStr.Split(",") + Dim nbbuf() As String + Data.Add(cmd) + nbbuf = strbuf(1).Split(":") + Data.Add(PowerSupply.GetNoCarDataKeyVal(nbbuf(0))) + Data.Add(CInt(key)) + Data.Add(strbuf(0)) + Data.AddRange(BitConverter.GetBytes(CShort(CInt(strbuf(14))))) + Data.Add(GetGlossary8(strbuf(15))) + For i = 1 To 11 '11变成10 + 'nbbuf = strbuf(i + 1).Split(":") + Data.Add(PowerSupply.GetNoCarDataKeyVal(strbuf(i + 1))) 'i 加 1 编程 i+2 + Next + Data.AddRange(BitConverter.GetBytes(CShort(CInt(strbuf(16))))) + Data.Add(GetGlossary8(strbuf(17))) + Return Data.ToArray End Function '条件信息 Public Function GetConditionalInformation(key As String, nStr As String) As Byte() @@ -2955,7 +3072,7 @@ Public Class TableInteraction Public Function GetGlossary8(sb As String) As Byte Dim result As Byte = 0 Select Case sb - Case "S" + Case "S","s" result = 1 Case "m" result = 2 @@ -3297,7 +3414,7 @@ Public Class TableInteraction End Select Next - + If Not String.IsNullOrEmpty(onecelltag.Item("7 Set music volume")) Then Musicdic.Add(7, onecelltag.Item("7 Set music volume")) End If @@ -3358,7 +3475,7 @@ Public Class TableInteraction End If - If String.IsNullOrEmpty(partime) AndAlso String.IsNullOrEmpty(partime1) Then Continue For + 'If String.IsNullOrEmpty(partime) AndAlso String.IsNullOrEmpty(partime1) Then Continue For If Rdic.ContainsKey("Dimming".ToUpper) OrElse Rdic.ContainsKey("PB_LINE_CONTROL".ToUpper) Then For Each devRKEYnode In devRKEY If Not String.IsNullOrEmpty(partime2) Then @@ -5980,7 +6097,7 @@ Public Class TableInteraction Air485ment.Add(Fnode) Case "485FloorHeat", "CLEDFLOORHEAT" Heat485ment.Add(Fnode) - Case "语音" + Case "Voice" Voicement.Add(Fnode) Case "Virtual_Card" VirtualCard.Add(Fnode) @@ -6245,6 +6362,7 @@ Public Class TableInteraction If outputGroupNode Is Nothing Then outputCount = 0 Else + If not outputGroupNode.DEV_TYPE_DATA.Equals("4") Then For Each node In outputGroupNode.Nodes 'If node.RowType <> RowNode.RowTypeEnum.DeviceObject Then Continue For 'If node.Compile = False Then Continue For @@ -6259,7 +6377,10 @@ Public Class TableInteraction Console.WriteLine($"{node.DefaultAliasName}{vbCrLf}") Next Console.WriteLine($"{outputGroupNode.Name}:{outputGroupNode.Nodes.Count }:{outputAliases.Count }{vbCrLf}") - End If + End If + End If + + buf.AddRange(BitConverter.GetBytes(inputCount)) '输入回路数(2字节) buf.AddRange(BitConverter.GetBytes(outputCount)) '输出回路数(2字节) diff --git a/BLV_Studio/bin/Debug/BLV_Studio.application b/BLV_Studio/bin/Debug/BLV_Studio.application index 4356469..8d10b89 100644 --- a/BLV_Studio/bin/Debug/BLV_Studio.application +++ b/BLV_Studio/bin/Debug/BLV_Studio.application @@ -21,7 +21,7 @@ - 1QCuL4trDDTEHx++/S6B3ui9dhzsEzVYKrSDjs39M7o= + JD39f/8+6QKEuUrfwG9KiYR2X1RY06nTXdxdv7PT5zk= diff --git a/BLV_Studio/bin/Debug/BLV_Studio.exe b/BLV_Studio/bin/Debug/BLV_Studio.exe index 3cd67ab..79221aa 100644 Binary files a/BLV_Studio/bin/Debug/BLV_Studio.exe and b/BLV_Studio/bin/Debug/BLV_Studio.exe differ diff --git a/BLV_Studio/bin/Debug/BLV_Studio.exe.manifest b/BLV_Studio/bin/Debug/BLV_Studio.exe.manifest index 448ea8b..b2bd3b3 100644 --- a/BLV_Studio/bin/Debug/BLV_Studio.exe.manifest +++ b/BLV_Studio/bin/Debug/BLV_Studio.exe.manifest @@ -4,7 +4,7 @@ - + @@ -102,14 +102,14 @@ - - + + - XfU2WQyz1e09VeoK1z61/izFX4HR0m/J4SHsaDP/LYQ= + PNSVXYV+QIryQii/zE88QcgDqSapXCDokv701XojbHI= @@ -677,15 +677,6 @@ pQWNFlScWo2PxMj/9/6h8MJeCjpUtDa0islXYxkQAEw= - - - - - - - +7X+tBYM4Whn1mJvI9Gmy6s+HcFVDtx9i+uAFSaoeH8= - - @@ -695,6 +686,15 @@ Yy1FAI5LiI9l95Et3ouEPka5K5WomLBs1RCnIgysfAo= + + + + + + + +7X+tBYM4Whn1mJvI9Gmy6s+HcFVDtx9i+uAFSaoeH8= + +