public void ShowData(int startid, string Backstr) { if (BackText.InvokeRequired) { ShowDataHandle sdh = new ShowDataHandle(ShowData); this.Invoke(sdh, new object[] { startid, Backstr }); } else { try { BackText.Text = Backstr; if (BackText.Text.Equals(SourceText.Text)) { Commparelabel.Text = "收到节点" + startid.ToString() + "回环数据与源数据一致!"; } else { Commparelabel.Text = "收到节点" + startid.ToString() + "回环数据与源数据不一致!"; } } catch (Exception e) { MessageBox.Show(e.Message); } } }
private void InputGrid() { if (DatatreeGrid.InvokeRequired) { ShowDataHandle sdh = new ShowDataHandle(InputGrid); this.Invoke(sdh, new object[] { }); } else { DatatreeGrid.Nodes.Clear(); int i = int.Parse(ll[0][0]);//最上级节点 AdvancedDataGridView.TreeGridNode node = DatatreeGrid.Nodes.Add("信源数据包", ""); foreach (string[] str in ll) { int j = int.Parse(str[0]); if (j > i) { node = node.Nodes.Add(str[1], str[2], str[3]); } else { if (i == j) { node = node.Parent.Nodes.Add(str[1], str[2], str[3]); } if (i == j + 1) { node = node.Parent.Parent.Nodes.Add(str[1], str[2], str[3]); } if (i == j + 2) { node = node.Parent.Parent.Parent.Nodes.Add(str[1], str[2], str[3]); } if (i == j + 3) { node = node.Parent.Parent.Parent.Parent.Nodes.Add(str[1], str[2], str[3]); } if (i == j + 4) { node = node.Parent.Parent.Parent.Parent.Parent.Nodes.Add(str[1], str[2], str[3]); } } i = j; } } }