public void AddSubnetwork(tSubNetwork sn) { var comm = (tCommunication)Tag; int i = comm.AddSubNetwork(sn); var n = new TreeNode(); n.Tag = comm.SubNetwork[i]; n.Text = comm.SubNetwork[i].name; n.Name = comm.SubNetwork[i].name; this.Nodes.Add(n); }
public SubnetworkNode(tSubNetwork sn) { if (sn == null) { return; } Name = sn.name; Tag = sn; if (sn.ConnectedAP != null) { for (int i = 0; i < sn.ConnectedAP.Length; i++) { var n = new ConnectedApNode(sn.ConnectedAP [i]); this.Nodes.Add(n); } } }
/// <summary> /// This method shows the information to edit all values pre-configured for /// subnetwork, connectedAP and tps /// </summary> /// <param name="treeSCL"> /// TreeNode reference /// </param> /// <param name="apParentName"> /// Name of Access Point where belongs the communication configurations. /// </param> /// <param name="iedParentName"> /// Name of IED where belongs the communication configurations. /// </param> private void CommunicationHandler(TreeNode treeSCL, string apParentName, string iedParentName) { tConnectedAP tconn = new tConnectedAP(); tSubNetwork tsub = new tSubNetwork(); tsub.desc = this.descSubNet.Text; String[] comm = new String[6]; String[] names = new String[6]; this.nameSubNet.Text = this.nameSubNetCB.SelectedItem.ToString(); tsub.name = this.nameSubNet.Text; comm[0] = this.ip.Text; comm[1] = this.mask.Text; comm[2] = this.gateway.Text; comm[3] = this.tsel.Text; comm[4] = this.psel.Text; comm[5] = this.ssel.Text; names[0] = "IP"; names[1] = "IP_SUBNET"; names[2] = "IP_GATEWAY"; names[3] = "OSI_TSEL"; names[4] = "OSI_PSEL"; names[5] = "OSI_SSEL"; for (int i = 0; i < this.scl.Communication.SubNetwork.Length; i++) { if (this.scl.Communication.SubNetwork[i].name == this.nameSubNetCB.SelectedItem.ToString()) { this.scl.Communication.SubNetwork[i].name = this.nameSubNet.Text; this.scl.Communication.SubNetwork[i].desc = this.descSubNet.Text; TreeNode connected = this.treeViewSCL.SeekAssociation(treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Nodes["tCommunication"].Nodes["tSubNetwork[]"].Nodes[i].Nodes, apParentName, iedParentName, "apName", "iedName"); if (connected != null) { tconn = (tConnectedAP)connected.Tag; tconn.iedName = iedParentName; tconn.apName = apParentName; if (this.objectManagement.ModifyObjectOfArrayObjectOfParentObject(tconn, connected.Index, connected.Parent.Parent.Tag)) { if (connected.FirstNode != null) { object arrayOf = connected.FirstNode.Tag; tP[] arr = (tP[])this.objectManagement.FindVariable(arrayOf, "P"); tAddress tad = new tAddress(); tconn.Address = tad; tconn.Address.P = arr; connected.Tag = tconn; if (arr != null) { for (int j = 0; j < arr.Length; j++) { for (int k = 0; k < names.Length; k++) { if (arr[j].type.ToString() == names[k]) { arr[j].Value = comm[k].ToString(); } } } this.objectManagement.ModifyObjectOfArrayObjectOfParentObject((tP[])arr, 0, tconn.Address.P); } else { DrawCommunication(); } } else { DrawCommunication(); } } } else { DrawCommunication(); } } } }