public IOCommunicationNode GetCommunicationNode(IO_SERVER server, IO_COMMUNICATION communication) { for (int i = 0; i < this.Nodes.Count; i++) { if (this.Nodes[i] is IOServerNode) { IOServerNode serNode = this.Nodes[i] as IOServerNode; if (serNode.Server == server) { for (int j = 0; j < serNode.Nodes.Count; j++) { if (serNode.Nodes[j] is IOCommunicationNode) { IOCommunicationNode commNode = serNode.Nodes[j] as IOCommunicationNode; if (commNode.Communication == communication) { return(commNode); } } } } } } return(null); }
private void DeviceNode_Click(object sender, EventArgs e) { MenuItem item = sender as MenuItem; switch (item.Tag.ToString()) { case "1": if (MessageBox.Show(this.TreeView.FindForm(), "是否要删除" + this.Device.IO_DEVICE_LABLE + "设备?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.Remove(); } break; case "2": FormManager.EditIODeviceNode(this); break; case "3": { IOCommunicationNode comNode = this.Parent as IOCommunicationNode; IOServerNode sNode = comNode.Parent as IOServerNode; FormManager.OpenDeviceParas(sNode.Server, comNode.Communication, this.Device); } break; } }
private void IOTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Clicks != 1) { return; } if (e.Node is IODeviceNode) { IOCommunicationNode comNode = e.Node.Parent as IOCommunicationNode; IOServerNode sNode = comNode.Parent as IOServerNode; IODeviceNode dNode = e.Node as IODeviceNode; FormManager.OpenDeviceParas(sNode.Server, comNode.Communication, dNode.Device); } }
public IOServerNode GetServerNode(IO_SERVER server) { for (int i = 0; i < this.Nodes.Count; i++) { if (this.Nodes[i] is IOServerNode) { IOServerNode serNode = this.Nodes[i] as IOServerNode; if (serNode.Server == server) { return(serNode); } } } return(null); }