Imports BLV_Studio.TableInteraction Imports Newtonsoft.Json 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 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 GetPortTable() GetIfTable() SetDevDescription() If Not IsCheckBox5 = CheckBox5.Checked Then If CheckBox5.Checked Then g_TableGrid.Cell(0, 0).Tag = 1 Else g_TableGrid.Cell(0, 0).Tag = 0 End If CheckBox5_CheckedChanged(Nothing, Nothing) End If Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() Return End Sub Public Sub SetDevDescription() If IsNothing(UniqueDevice) Then Return Dim rstr = String.Empty If CheckBox4.Checked Then rstr = $"1," Else rstr = $"0," End If rstr = $"{rstr}{NR_TextBox2.Text },{NR_ComboBox1.SelectedIndex + 1}" UniqueDevice.Desc.ProtocolData = rstr End Sub Public Sub GetDevDescription() If IsNothing(UniqueDevice) Then Return If String.IsNullOrEmpty(UniqueDevice.Desc.ProtocolData) Then Return Dim rstr() As String = UniqueDevice.Desc.ProtocolData.Split(",") If rstr(0) = "1" Then CheckBox4.Checked = True NR_TextBox2.Text = rstr(1) NR_ComboBox1.SelectedIndex = CInt(rstr(2)) - 1 Else CheckBox4.Checked = False NR_TextBox2.Text = rstr(1) NR_ComboBox1.SelectedIndex = CInt(rstr(2)) - 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 ' 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}" 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 Public Function GetIfTable() As Boolean If IsNothing(UniqueDevice) Then Return False Dim rstr As Dictionary(Of String, List(Of String)) = New Dictionary(Of String, List(Of String)) 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 rstr.ContainsKey(headname.devname) Then li = rstr.Item(headname.devname) Else li = New List(Of String) rstr.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 Dim str As String = JsonConvert.SerializeObject(rstr) UniqueDevice.Desc.DevDescription = str Return True End Function Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress '数字0~9所对应的keychar为48~57 e.Handled = True '输入0-9 If e.KeyChar = vbBack OrElse (Asc(e.KeyChar) >= 47 AndAlso Asc(e.KeyChar) <= 58) Then e.Handled = False End If End Sub 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() End If End Sub #Region “初始化表格“ Private UniqueDevice As DeviceModel Private NoCardNode As DeviceChildNodeClass Private ParseDevDic As Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, List(Of (String, String))))) 'Public Sub ParseDeviceList(TableGrid As FlexCell.Grid) ' ParseDevDic = New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, List(Of (String, String))))) ' If IsNothing(TableGrid) Then ' Return ' End If ' Dim keyname As String = String.Empty ' Dim loopval As String = String.Empty ' For i = TableRowNumber.Max To TableGrid.Rows - 1 ' keyname = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}({TableGrid.Cell(i, TableColNumber.SceneID).Text})" ' loopval = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}" ' Next 'End Sub Public g_TableGrid As FlexCell.Grid Public G_ActionConfiguration As List(Of TableRowTag) Public IsCheckBox5 As Boolean Public Sub ParseDeviceList(Devicemodel As Dictionary(Of String, DeviceModel), TableGrid As FlexCell.Grid) Dic_Devicemodel = Devicemodel ParseDevDic = New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, List(Of (String, String))))) Dim typename As String If Not IsNothing(TableGrid.Cell(0, 0).Tag) Then Dim sss As String = TableGrid.Cell(0, 0).Tag.ToString If TableGrid.Cell(0, 0).Tag.ToString.Equals("1") Then CheckBox5.Checked = 1 IsCheckBox5 = True Else CheckBox5.Checked = 0 IsCheckBox5 = False End If End If g_TableGrid = TableGrid Dim keyname As String = String.Empty Dim loopval As String = String.Empty For i = TableRowNumber.Max To TableGrid.Rows - 1 keyname = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}({TableGrid.Cell(i, TableColNumber.SceneID).Text})" loopval = $"{ TableGrid.Cell(i, TableColNumber.KeyVal).Text}" If keyname.Contains("radar") OrElse keyname.Contains("infrared") OrElse keyname.Contains("Insert card") OrElse keyname.Contains("pull out") OrElse keyname.Contains("door contact") Then Dim griddev As CtabRange = New CtabRange(TableGrid, i, TableColNumber.DeviceName) If griddev.devname.Equals("HOSTSERVICE") Then Continue For If Dic_Devicemodel.ContainsKey(griddev.devname) Then Dim index As DeviceModel = Dic_Devicemodel.Item(griddev.devname) For Each node In index.Nodes If node.Name.Equals("Virtual_Card") Then UniqueDevice = index NoCardNode = node Exit For Else If node.Interface.Equals("DI") Then For Each subnode In node.Nodes If subnode.LoopAddr.Equals(loopval) Then Dim loopli = New List(Of (String, String)) Dim loopdic = New Dictionary(Of String, List(Of (String, String))) Dim addressdic = New Dictionary(Of String, Dictionary(Of String, List(Of (String, String)))) Dim addr As String If index.Desc.Name.Equals("BLV_C12") Then addr = 0 Else addr = FindAttributeValueUnderModel(index, "Device present", "Dialing address") End If ParseDevDic.Add(keyname, addressdic) addressdic.Add(loopval, loopdic) loopli.Add((addr, "")) loopdic.Add(node.DEV_TYPE_DATA, loopli) End If Next End If End If Next Else Continue For End If End If Next For Each index In Dic_Devicemodel.Values For Each node In index.Nodes If node.Name.Equals("Virtual_Card") Then UniqueDevice = index NoCardNode = node Exit For End If ' If node.Interface.Equals("DI") Then ' typename = GetAnotherName(node.Name) ' typename = $"{node.Name}" ' If String.IsNullOrEmpty(typename) Then ' Continue For ' Else ' Dim addressdic As Dictionary(Of String, Dictionary(Of String, List(Of (String, String)))) ' If ParseDevDic.ContainsKey(typename) Then ' addressdic = ParseDevDic.Item(typename) ' Else ' addressdic = New Dictionary(Of String, Dictionary(Of String, List(Of (String, String)))) ' ParseDevDic.Add(typename, addressdic) ' End If ' Dim addr As String ' Dim loopdic As Dictionary(Of String, List(Of (String, String))) ' Dim loopli As List(Of (String, String)) ' If index.Desc.Name.Equals("BLV_C12") Then ' addr = 0 ' Else ' addr = FindAttributeValueUnderModel(index, "设备存在", "拨码地址") ' End If ' If addressdic.ContainsKey(addr) Then ' loopdic = addressdic.Item(addr) ' Else ' loopdic = New Dictionary(Of String, List(Of (String, String))) ' addressdic.Add(addr, loopdic) ' End If ' If loopdic.ContainsKey(node.DEV_TYPE_DATA) Then ' loopli = loopdic.Item(node.DEV_TYPE_DATA) ' Else ' loopli = New List(Of (String, String)) ' loopdic.Add(node.DEV_TYPE_DATA, loopli) ' End If ' For Each liindex In node.Nodes ' loopli.Add((liindex.LoopAddr, liindex.DefaultAliasName)) ' Next ' End If ' Else ' Continue For ' End If Next Next End Sub Private Function FindAttributeValueUnderModel(pNode As DeviceModel, groupName As String, attributeName As String) As String For Each cnode In pNode.Config If cnode.Name.Equals(groupName) Then For Each ccnode In cnode.Attributes If ccnode.Name.Equals(attributeName) Then Return ccnode.Value End If Next End If Next End Function Public Shared Function GetAnotherName(str As String) As String Dim result As String = String.Empty If String.IsNullOrEmpty(str) Then Return result Else Select Case str Case "CLED_FRESHAIR" result = "CLED新风" Case "CLEDFLOORHEAT" result = "CLED地暖" Case "485FloorHeat" result = "地暖" Case "485FreshAir" result = "新风" Case "485MUSIC" result = "485音乐" Case "CURTAIN" result = "干接点窗帘" Case "INFRARED_FORWARD" result = "红外" Case "RS485_Curtain" result = "485窗帘" Case "RELAY" result = "继电器" Case "MUSIC" result = "音乐" Case "Dimming" result = "调光" Case "DO" result = "输出" Case "Temp" result = "空调" Case "PB_LINE_CONTROL" result = "主机恒压调光" Case "PB_STRIP_DEVICE" result = "PLC恒压调光" Case "PB_RELAY_DEVICE" result = "PLC继电器" 'Case "KEY" ' result = "普通按键" Case Else result = $"{str}" End Select End If Return result End Function Public isxiugai1 As Boolean = False Public Sub InitPortTable(Node As DeviceChildNodeClass) PortTable.NewFile() PortTable.ExtendLastCol = False PortTable.Cols = 5 PortTable.Rows = Node.Nodes.Count + 1 PortTable.Cell(0, 0).Text = "Port" PortTable.Cell(0, 1).Text = "Alternative name" PortTable.Cell(0, 2).Text = "Input port (Requires setting the alias of the input loop on the home page first)" PortTable.Cell(0, 3).Text = "Release time (percentage) threshold" PortTable.Cell(0, 4).Text = "Whether to participate in the continuous unmanned judgment process" PortTable.Row(0).Locked = True PortTable.Column(0).Width = 100 PortTable.Column(2).Width = 280 PortTable.Column(3).Width = 150 PortTable.Column(4).Width = 80 PortTable.Column(1).Width = 100 ' 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.CheckBox 'PortTable.Column(1).Locked = True PortTable.ComboBox(2).Locked = True PortTable.ComboBox(3).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 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 = 7 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) 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) 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 Case 1 result = "Insert card" Case 2 result = "Open door contact" Case 3 result = "Doorway infrared" Case 4 result = "Toilet infrared" Case 5 result = "Bathroom infrared" Case 6 result = "bed infrared" Case 7 result = "Mirror infrared" Case 8 result = "fallow infrared" Case 9 result = "Living room infrared" Case 10 result = "Living room bathroom infrared" Case 11 result = "bathtub infrared" End Select Return result End Function Private IfGridRowdic As Dictionary(Of String, List(Of String)) Public Sub InitIfGrid(jsonstr As String, Optional ifbn As Boolean = True) IfGrid.NewFile() IfGrid.ExtendLastCol = False IfGrid.Cols = 17 IfGrid.Rows = 1 IfGrid.Cell(0, 1).Text = "Set of conditions" IfGrid.Cell(0, 2).Text = "Conditional sequence number" IfGrid.Cell(0, 3).Text = "unmarked" IfGrid.Cell(0, 4).Text = "CH1" IfGrid.Cell(0, 5).Text = "CH2" IfGrid.Cell(0, 6).Text = "CH3" IfGrid.Cell(0, 7).Text = "CH4" IfGrid.Cell(0, 8).Text = "CH5" IfGrid.Cell(0, 9).Text = "CH6" IfGrid.Cell(0, 10).Text = "CH7" IfGrid.Cell(0, 11).Text = "CH8" IfGrid.Cell(0, 12).Text = "CH9" IfGrid.Cell(0, 13).Text = "CH10" IfGrid.Cell(0, 14).Text = "CH11" IfGrid.Cell(0, 15).Text = "Delay Time" IfGrid.Cell(0, 16).Text = "Time 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(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(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.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 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 BuildTableRow() 'IfGridRowdic = New Dictionary(Of String, List(Of String)) ''Dim li As List(Of String) = New List(Of String) 'For i = 1 To 3 ' Dim li As List(Of String) = New List(Of String) ' IfGrid.AddItem("") ' 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, 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 = $"0" ' IfGrid.Cell(IfGrid.Rows - 1, 15).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,0,s") ' IfGridRowdic.Add(i, li) 'Next 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.Column(1).Locked = True End If Next End If Catch ex As Exception BuildTableRow() 'IfGridRowdic = New Dictionary(Of String, List(Of String)) 'For i = 1 To 3 ' Dim li As List(Of String) = New List(Of String) ' IfGrid.AddItem("") ' 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, 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 = $"0" ' IfGrid.Cell(IfGrid.Rows - 1, 15).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,0,s") ' IfGridRowdic.Add(i, li) 'Next End Try End Sub Public Sub BuildTableRow() IfGridRowdic = New Dictionary(Of String, List(Of String)) Dim li7 As List(Of String) = New 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 = $"trigger" 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 = $"1" IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"s" li7.Add($"1,1,1,Not judging,trigger,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,1,s") IfGridRowdic.Add(1, li7) Dim li1 As List(Of String) = New List(Of String) 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 emptiness to fullness" IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Release" 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 = $"1" IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"s" li1.Add($"2,1,1,Not judging,Release,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,1,s") IfGridRowdic.Add(2, li1) Dim li2 As List(Of String) = New List(Of String) 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 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 = $"trigger" 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 = $"s" li2.Add($"3,1,1,Not judging,Not judging,trigger,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,0,s") 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 = $"s" li2.Add($"2,1,2,Not judging,Not judging,Not judging,trigger,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,0,s") 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 = $"s" li2.Add($"3,1,3,Not judging,Not judging,Not judging,Not judging,trigger,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,0,s") 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 = $"s" li2.Add($"3,1,4,Not judging,Not judging,Not judging,Not judging,Not judging,trigger,Not judging,Not judging,Not judging,Not judging,Not judging,0,s") 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 = $"s" li2.Add($"3,1,5,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,trigger,Not judging,Not judging,Not judging,Not judging,0,s") 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 = $"s" li2.Add($"3,1,6,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,trigger,Not judging,Not judging,Not judging,0,s") 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 = $"s" li2.Add($"3,1,7,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,trigger,Not judging,Not judging,0,s") 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 = $"s" li2.Add($"3,1,8,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,trigger,Not judging,0,s") 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 = $"s" li2.Add($"3,1,9,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,trigger,0,s") IfGrid.Column(1).Locked = False IfGrid.Range(startR, 1, IfGrid.Rows - 1, 1).Merge() IfGrid.Column(1).Locked = True IfGridRowdic.Add(3, li2) Dim li3 As List(Of String) = New List(Of String) 'IfGrid.AddItem("") '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 = "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 = $"trigger" '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 = $"s" 'li1.Add($"4,1,2,Not judging,Not judging,trigger,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,0,s") 'IfGridRowdic.Add(4, li3) Dim li4 As List(Of String) = New List(Of String) IfGrid.AddItem("") 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 = "From fullness to emptiness" IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"Release" 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 = $"s" li1.Add($"4,1,2,Not judging,Release,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,0,s") IfGridRowdic.Add(5, li4) Dim li5 As List(Of String) = New List(Of String) 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 = 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 = $"trigger" 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 = $"20" IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"s" li1.Add($"5,1,2,Not judging,trigger,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,Not judging,20,s") IfGridRowdic.Add(6, li5) Dim li6 As List(Of String) = New List(Of String) 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 = "From fullness to emptiness" IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"Not judging" IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"trigger" 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 = $"5" IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"m" li1.Add($"6,1,2,Not judging,,trigger,Release,Release,Release,Release,Release,Release,Release,Release,Release,5,m") IfGridRowdic.Add(7, li6) 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 Select Case e.Col Case 2 PortTable.ComboBox(e.Col).Items.Clear() PortTable.ComboBox(e.Col).Items.Add(" ") PortTable.ComboBox(e.Col).Items.AddRange(ParseDevDic.Keys.ToArray) 'Case "端口地址" ' Dim addr As String = PortTable.Cell(e.Row, e.Col - 1).Text ' If String.IsNullOrEmpty(addr) Then ' MsgBox("请先选择端口类型!") ' Return ' End If ' PortTable.ComboBox(e.Col).Items.Clear() ' PortTable.ComboBox(e.Col).Items.AddRange(ParseDevDic.Item(addr).Keys.ToArray) 'Case "端口回路" ' Dim typestr As String = PortTable.Cell(e.Row, e.Col - 2).Text ' Dim addr As String = PortTable.Cell(e.Row, e.Col - 1).Text ' If String.IsNullOrEmpty(addr) OrElse String.IsNullOrEmpty(typestr) Then ' MsgBox("请先选择端口类型!") ' Return ' End If ' PortTable.ComboBox(e.Col).Items.Clear() ' For Each index In ParseDevDic.Item(typestr).Item(addr).Values(0).ToArray ' PortTable.ComboBox(e.Col).Items.Add(index.Item1) ' Next ' 'PortTable.ComboBox(e.Col).Items.AddRange(ParseDevDic.Item(typestr).Item(addr).Values(0).ToArray) ' PortTable.Cell(e.Row, e.Col).Tag = ParseDevDic.Item(typestr).Item(addr).Keys(0) 'PortTable.Cell(e.Row, 1).Text = Case 3 PortTable.ComboBox(e.Col).Items.Clear() For i = 0 To 100 PortTable.ComboBox(e.Col).Items.Add(i) Next End Select End Sub Private Sub IfGrid_ComboDropDown(Sender As Object, e As FlexCell.Grid.ComboDropDownEventArgs) Handles IfGrid.ComboDropDown 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.Clear() IfGrid.ComboBox(e.Col).Items.AddRange({"Not judging", "trigger", "Release"}) ElseIf e.Col = 15 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 IfGrid.ComboBox(e.Col).Items.Clear() IfGrid.ComboBox(e.Col).Items.AddRange({"s", "m", "h"}) End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim headname As String = IfGrid.Cell(IfGrid.ActiveCell.Row, 2).Text If headname.Equals("1") Then Return Dim inrow As Integer = IfGrid.ActiveCell.Row Dim Number = Integer.Parse(IfGrid.Cell(inrow, 2).Text) Dim li As List(Of String) Dim indexstr As CtabRange = New CtabRange(IfGrid, IfGrid.ActiveCell.Row, 1) li = IfGridRowdic.Item(indexstr.devname) li.RemoveAt(Number - 1) IfGrid.Row(IfGrid.ActiveCell.Row).Delete() For i = Number To li.Count IfGrid.Cell(inrow, 2).Text = i inrow = inrow + 1 Next End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click AddIfGridRow() End Sub Public Sub AddIfGridRow() Dim inrow As Integer = IfGrid.ActiveCell.Row IfGrid.InsertRow(inrow, 1) Dim li As List(Of String) Dim nodestr As String = String.Empty Dim number As Integer For i = 0 To IfGrid.Cols - 1 Dim indexstr As String = (New CtabRange(IfGrid, inrow + 1, 1)).devname li = IfGridRowdic.Item(indexstr) IfGrid.Cell(inrow, i).Text = IfGrid.Cell(inrow + 1, i).Text If i = 1 Then IfGrid.Cell(inrow, i).Tag = (New CtabRange(IfGrid, inrow + 1, 1)).devname ElseIf i = 2 Then number = Integer.Parse(IfGrid.Cell(inrow + 1, 2).Text) End If nodestr = $"{nodestr},{ IfGrid.Cell(inrow + 1, i).Text}" Next IfGrid.Column(1).Locked = False IfGrid.Range(inrow, 1, inrow + 1, 1).Merge() IfGrid.Column(1).Locked = True nodestr = nodestr.Remove(0, 1) li.Add(nodestr) For i = number To li.Count IfGrid.Cell(inrow, 2).Text = i inrow = inrow + 1 Next End Sub Private Sub PortTable_CellChange(Sender As Object, e As FlexCell.Grid.CellChangeEventArgs) Handles PortTable.CellChange If e.Row > 0 AndAlso e.Col = 1 Then Dim headname As String = PortTable.Cell(e.Row, e.Col).Text.Trim IfGrid.Cell(0, e.Row + 3).Text = headname If String.IsNullOrEmpty(headname) Then IfGrid.Column(e.Row + 3).Locked = True Else IfGrid.Column(e.Row + 3).Locked = False End If ElseIf e.Row > 0 AndAlso e.Col = 2 Then 'Dim addr As String = PortTable.Cell(e.Row, e.Col).Text 'If String.IsNullOrEmpty(addr) Then ' PortTable.Cell(e.Row, e.Col).Tag = "" 'Else ' ParseDevDic.Item(PortTable.Cell(e.Row, e.Col - 1).Text).Item(addr).Values(0).ToArray() 'End If 'ElseIf e.Row > 0 AndAlso e.Col = 4 Then ' Dim typestr As String = PortTable.Cell(e.Row, e.Col - 2).Text ' Dim addr As String = PortTable.Cell(e.Row, e.Col - 1).Text ' Dim nloop As String = PortTable.Cell(e.Row, e.Col).Text ' If String.IsNullOrEmpty(addr) OrElse String.IsNullOrEmpty(typestr) Then ' PortTable.Cell(e.Row, e.Col).Text = "" ' MsgBox("请先选择端口类型!") ' Return ' End If ' For Each index In ParseDevDic.Item(typestr).Item(addr).Values(0).ToArray ' If index.Item1.Equals(nloop) AndAlso isxiugai1 Then ' PortTable.Cell(e.Row, 1).Text = index.Item2 ' End If ' Next End If End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() Return End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click Dim i As String = (CInt(New CtabRange(IfGrid, IfGrid.Rows - 1, 1).devname) + 1) Dim li As List(Of String) = New List(Of String) IfGrid.AddItem("") 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, 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 = $"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") IfGridRowdic.Add(i, li) End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click 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 For i = headname.fr To headname.lr IfGrid.Row(headname.lr - number).Delete() number = number + 1 Next 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) Else End If Next GetIfTable() InitIfGrid(UniqueDevice.Desc.DevDescription) End Sub Private Sub IfGrid_CellChange(Sender As Object, e As FlexCell.Grid.CellChangeEventArgs) Handles IfGrid.CellChange 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 IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Orange ElseIf celltext.Contains("Release") 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 IfGrid.Cell(e.Row, e.Col).ForeColor = Color.OrangeRed End If End Sub 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 Return 2 ElseIf keystr.Contains("Release") Then Return 2 ElseIf keystr.Contains("Not judging") Then Return 0 ElseIf keystr.Contains("trigger") Then Return 1 End If Return 0 End Function Private Sub TextBox2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles NR_TextBox2.KeyPress e.Handled = Not $"0123456789{vbBack}".Contains(e.KeyChar) '如果要只允许输入数字,就把上一行字符串中的字母删除 End Sub Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.CheckedChanged NR_ComboBox1.Enabled = CheckBox4.Checked NR_label3.Enabled = CheckBox4.Checked NR_TextBox2.Enabled = CheckBox4.Checked End Sub Public maxdelayed 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 Else maxdelayed = 600 End If End Sub Private Sub NR_TextBox2_TextChanged(sender As Object, e As EventArgs) Handles NR_TextBox2.TextChanged Dim tint As Integer = CInt(NR_TextBox2.Text) If tint > maxdelayed Then NR_TextBox2.Text = maxdelayed End If End Sub Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) If IsNothing(g_TableGrid) OrElse g_TableGrid.Rows = 0 OrElse IsNothing(G_ActionConfiguration) OrElse G_ActionConfiguration.Count = 0 Then Return Dim devmodw As DeviceModel Dim loadtag As TableRowTag Dim num As UInt64 = 0 Dim numbuf() As String For i = TableRowNumber.Max To g_TableGrid.Rows - 1 Dim griddev As CtabRange = New CtabRange(g_TableGrid, i, TableColNumber.DeviceName) i = griddev.lr For j = griddev.fr To griddev.lr loadtag = G_ActionConfiguration(j - 7) If Dic_Devicemodel.ContainsKey(loadtag.G_DevModeName) Then devmodw = Dic_Devicemodel.Item(loadtag.G_DevModeName) For Each node In devmodw.Nodes If node.Name.Equals(loadtag.G_DevNodeName) Then For Each index In node.Nodes If index.LoopAddr.Equals(loadtag.G_DevNodeIndex.ToString) Then 'selectstr = index.DefaultClass If index.DefaultClass.Equals("KEY") AndAlso Not node.PROTOCOL_VER.Equals("003") Then numbuf = g_TableGrid.Cell(j, TableColNumber.SceneAttribute).Text.Split(",") If numbuf.Length < 3 Then Continue For num = UInt64.Parse(numbuf(2)) If CheckBox5.Checked Then num = num Or (1 << 4) Else num = num - (1 << 4) End If g_TableGrid.Cell(j, TableColNumber.SceneAttribute).Text = $"{numbuf(0)},{numbuf(1)},{num}" End If End If Next End If Next End If Next Next End Sub #End Region End Class