Imports BLV_Studio.TableInteraction Imports FlexCell 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 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() 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 '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, CardNodestr As String) Dim portname, chname As String Dim cbuf As String() = intenndoe.Description.Split(",") If cbuf.Length > 1 Then portname = cbuf(1) If CardNodestr.Contains(portname) Then Return End If 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, addserviceData1 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 - 5 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 Return 'addserviceData = "13,1,0,1," 'addserviceData1 = "13,2,0,1," ElseIf chname.Contains("CH2") Then addserviceData = "32,1,0,1," addserviceData1 = "32,2,0,1," ElseIf chname.Contains("CH3") Then addserviceData = "33,1,0,1," addserviceData1 = "33,2,0,1," ElseIf chname.Contains("CH4") Then addserviceData = "34,1,0,1," addserviceData1 = "34,2,0,1," ElseIf chname.Contains("CH5") Then addserviceData = "35,1,0,1," addserviceData1 = "35,2,0,1," ElseIf chname.Contains("CH6") Then addserviceData = "36,1,0,1," addserviceData1 = "36,2,0,1," ElseIf chname.Contains("CH7") Then addserviceData = "37,1,0,1," addserviceData1 = "37,2,0,1," ElseIf chname.Contains("CH8") Then addserviceData = "38,1,0,1," addserviceData1 = "38,2,0,1," ElseIf chname.Contains("CH9") Then addserviceData = "39,1,0,1," addserviceData1 = "39,2,0,1," ElseIf chname.Contains("CH10") Then addserviceData = "40,1,0,1," addserviceData1 = "40,2,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 Dim cloopkey = g_TableGrid.Cell(tabrow, TableColNumber.KeyVal).Text deleteG_TableGridService2(tabrow, cloopkey, addserviceData1) End If Next End Sub Public Sub deleteG_TableGridService2(row As Integer, loopkey As String, scene As String) Dim cloopkey, cscene, serviceData As String Dim cscenebuf As String() Dim cr As CtabRange = New CtabRange(g_TableGrid, row, TableColNumber.DeviceName) '遍历行 For i = cr.fr To cr.lr cloopkey = g_TableGrid.Cell(i, TableColNumber.KeyVal).Text cscene = g_TableGrid.Cell(i, TableColNumber.SceneAttribute).Text '判断loopkey是否相当于cloopkey If cloopkey.Equals(loopkey) Then cscenebuf = cscene.Split(",") If cscenebuf(0).Equals("2") Then serviceData = g_TableGrid.Cell(i, TableColNumber.ServerAttribute).Text If serviceData.Contains(scene) Then serviceData = serviceData.Replace(scene, "") g_TableGrid.Cell(i, TableColNumber.ServerAttribute).Text = serviceData.Trim End If End If End If Next End Sub Public Sub SetG_TableGridService(portname As String, chname As String) Dim serviceData, cloopkey As String Dim addserviceData, addserviceData1 As String Dim crow As Integer ''遍历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 cloopkey = g_TableGrid.Cell(j, TableColNumber.KeyVal).Text crow = j '21,1,0,1, '21,2,10,2, If chname.Contains("CH1") Then addserviceData = "13,1,0,1," addserviceData1 = "13,2,0,1," ElseIf chname.Contains("CH2") Then addserviceData = "32,1,0,1," addserviceData1 = "32,2,0,1," ElseIf chname.Contains("CH3") Then addserviceData = "33,1,0,1," addserviceData1 = "33,2,0,1," ElseIf chname.Contains("CH4") Then addserviceData = "34,1,0,1," addserviceData1 = "34,2,0,1," ElseIf chname.Contains("CH5") Then addserviceData = "35,1,0,1," addserviceData1 = "35,2,0,1," ElseIf chname.Contains("CH6") Then addserviceData = "36,1,0,1," addserviceData1 = "36,2,0,1," ElseIf chname.Contains("CH7") Then addserviceData = "37,1,0,1," addserviceData1 = "37,2,0,1," ElseIf chname.Contains("CH8") Then addserviceData = "38,1,0,1," addserviceData1 = "38,2,0,1," ElseIf chname.Contains("CH9") Then addserviceData = "39,1,0,1," addserviceData1 = "39,2,0,1," ElseIf chname.Contains("CH10") Then addserviceData = "40,1,0,1," addserviceData1 = "40,2,0,1," Else Exit For End If '判断serviceData是否包含addserviceData If serviceData.Contains(addserviceData) Then Exit For 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 If Not String.IsNullOrEmpty(addserviceData1) AndAlso Not String.IsNullOrEmpty(cloopkey) Then SetG_TableGridService2(crow, cloopkey, addserviceData1) End If 'Next End Sub Public Sub SetG_TableGridService2(row As Integer, loopkey As String, scene As String) Dim cloopkey, cscene, serviceData As String Dim cscenebuf As String() Dim cr As CtabRange = New CtabRange(g_TableGrid, row, TableColNumber.DeviceName) '遍历行 For i = cr.fr To cr.lr cloopkey = g_TableGrid.Cell(i, TableColNumber.KeyVal).Text cscene = g_TableGrid.Cell(i, TableColNumber.SceneAttribute).Text '判断loopkey是否相当于cloopkey If cloopkey.Equals(loopkey) Then cscenebuf = cscene.Split(",") If cscenebuf(0).Equals("2") Then serviceData = g_TableGrid.Cell(i, TableColNumber.ServerAttribute).Text If serviceData.Contains(scene) Then Return End If '判断serviceData是否为空 If String.IsNullOrEmpty(serviceData) Then serviceData = scene Else serviceData = $"{scene}{vbLf}{serviceData}" End If g_TableGrid.Cell(i, TableColNumber.ServerAttribute).Text = serviceData Return End If End If Next G_TableInteraction.grdSetFocus(row, 2) Console.WriteLine(g_TableGrid.ActiveCell.Row) ToolStripMenuItem16Click() ToolStripMenuItem17Click() g_TableGrid.Cell(row + 1, TableColNumber.ServerAttribute).Text = scene scene = g_TableGrid.Cell(row + 1, TableColNumber.SceneAttribute).Text '将scene第一个字符换成2 scene = "2" & scene.Substring(1) g_TableGrid.Cell(row + 1, TableColNumber.SceneAttribute).Text = scene End Sub Private Sub ToolStripMenuItem16Click() If IsNothing(G_TableInteraction) Then Return G_TableInteraction.CopySceneActionData() End Sub Private Sub ToolStripMenuItem17Click() If IsNothing(G_TableInteraction) Then Return G_TableInteraction.GlueSceneActionData() 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 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() 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 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 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}" 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), rstr) 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), rstr) NoCardNode.Nodes(i - 1).Description = rstr Next End If 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) 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 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 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) keystr = String.Empty Next Dim str As String = JsonConvert.SerializeObject(rstr) UniqueDevice.Desc.DevDescription = str 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 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 Public Isoneload As Boolean = False Private Sub PowerSupply_Load(sender As Object, e As EventArgs) Handles MyBase.Load 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 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 G_TableInteraction As TableInteraction 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 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 Case 1 result = "Insert card" Case 2 result = "Open 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 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 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, 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 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", "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 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 = 17 OrElse e.Col = 19 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() 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) 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 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" 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" 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() 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 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 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") 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 Return 2 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 ElseIf keystr.Contains("Release") OrElse keystr.Contains("Open") Then Return 2 ElseIf keystr.Contains("Not judging") Then Return 0 ElseIf keystr.Contains("trigger") OrElse keystr.Contains("Close") 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 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 Else 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) 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 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 #End Region End Class