void OnReadDataClick(object sender, EventArgs e) { NodeBase data = (NodeBase)(sender as ToolStripItem).Tag; Iec61850State iecs = data.GetIecs(); NodeBase[] ndarr = new NodeBase[1]; ndarr[0] = data; iecs.Send(ndarr, data.CommAddress, ActionRequested.Read); }
void OnSendCommandAsStructureClick(object sender, EventArgs e) { NodeBase data = (NodeBase)(sender as ToolStripItem).Tag; Iec61850State iecs = data.GetIecs(); NodeBase[] ndarr = new NodeBase[1]; SendCommand(data, iecs, ActionRequested.WriteAsStructure); }
void OnFileGetClick(object sender, EventArgs e) { NodeBase nfi = (NodeBase)(sender as ToolStripItem).Tag; Iec61850State iecs = nfi.GetIecs(); CommAddress ad = new CommAddress(); NodeBase[] ndarr = new NodeBase[1]; ndarr[0] = nfi; iecs.Send(ndarr, ad, ActionRequested.OpenFile); }
internal ControllableSignalsDialog(NodeBase data /*, EventHandler onNVListChanged)*/) { InitializeComponent(); this.data = data; this.TopMost = true; button2.Enabled = false; button3.Enabled = false; Iec61850State iecs = data.GetIecs(); NodeBase[] datacns = data.GetChildNodes(); foreach (NodeLN datacn in datacns) { NodeBase[] nfccns = datacn.GetChildNodes(); foreach (NodeFC nfccn in nfccns) { if (nfccn.Name == "CO") { NodeBase[] ndatacns = nfccn.GetChildNodes(); foreach (NodeDO ndatacn in ndatacns) { if (ndatacn.Name.Contains("SPCSO") || ndatacn.Name.Contains("RcdTrg") || ndatacn.Name.Contains("Pos")) { NodeBase ctlval = iecs.DataModel.ied.FindNodeByAddress(ndatacn.CommAddress.Domain + "/" + ndatacn.CommAddress.Variable + "$Oper$ctlVal"); NodeBase desc = iecs.DataModel.ied.FindNodeByAddress(ndatacn.CommAddress.Domain + "/" + ndatacn.CommAddress.Variable.Replace("$CO$", "$DC$") + "$d"); if (ctlval != null) { ListViewItem item = new ListViewItem(new[] { ctlval.IecAddress, ((desc != null) ? (desc as NodeData).StringValue : ""), }); item.Tag = ctlval; listView1.Items.Add(item); } } } } } } }
void OnFileListClick(object sender, EventArgs e) { NodeBase nfi = (NodeBase)(sender as ToolStripItem).Tag; Iec61850State iecs = nfi.GetIecs(); CommAddress ad = new CommAddress(); NodeBase[] ndarr = new NodeBase[1]; ndarr[0] = nfi; if (!(nfi is NodeFile)) { NodeData nd = new NodeData("x"); nd.DataType = scsm_MMS_TypeEnum.visible_string; nd.DataValue = "/"; EditValue ev = new EditValue(nd); DialogResult r = ev.ShowDialog(); if (r == DialogResult.OK) { ad.Variable = nd.StringValue; } } iecs.Send(ndarr, ad, ActionRequested.GetDirectory); }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == MouseButtons.Right && e.Node != null) { NodeBase n = (NodeBase)e.Node.Tag; ContextMenuStrip menu = new ContextMenuStrip(); ToolStripItem item; if (n != null) { if (n is NodeVL) { if ((n as NodeVL).Defined) { if ((n as NodeVL).Activated) { item = menu.Items.Add("Deactivate Reports"); item.Tag = n; item.Click += new EventHandler(OnDeactivateNVLClick); } else { item = menu.Items.Add("Activate Reports"); item.Tag = n; item.Click += new EventHandler(OnActivateNVLClick); } } else { item = menu.Items.Add("Send Define Report Request"); item.Tag = n; item.Click += new EventHandler(OnDefineNVLClick); } if ((n as NodeVL).Deletable) { item = menu.Items.Add("Delete Report"); item.Tag = n; item.Click += new EventHandler(OnDeleteNVLClick); } } else if (e.Node.Text == "lists" && n.GetIecs().ied.DefineNVL) { item = menu.Items.Add("Add New Name List"); item.Tag = n; listsNode = e.Node; item.Click += new EventHandler(OnAddNVLClick); } else if (e.Node.Text == "files") { item = menu.Items.Add("Read File List"); item.Tag = n; listsNode = e.Node; item.Click += new EventHandler(OnFileListClick); } if (n is NodeFile && (n as NodeFile).isDir) { item = menu.Items.Add("Read File List"); item.Tag = n; listsNode = e.Node; item.Click += new EventHandler(OnFileListClick); } if (n is NodeFile && !(n as NodeFile).isDir && !(n as NodeFile).FileReady) { item = menu.Items.Add("Get File"); item.Tag = n; listsNode = e.Node; item.Click += new EventHandler(OnFileGetClick); } if (n is NodeFile && !(n as NodeFile).isDir && (n as NodeFile).FileReady) { item = menu.Items.Add("Save File"); item.Tag = n; listsNode = e.Node; item.Click += new EventHandler(OnFileSaveClick); } if (n is NodeData && n.Name == "ctlVal") { item = menu.Items.Add("Send Command (Writes)"); item.Tag = n; item.Click += new EventHandler(OnSendCommandClick); item = menu.Items.Add("Send Command (Structure)"); item.Tag = n; item.Click += new EventHandler(OnSendCommandAsStructureClick); } if (n is NodeData || n is NodeFC) { item = menu.Items.Add("Read Data"); item.Tag = n; item.Click += new EventHandler(OnReadDataClick); } if (n is NodeData && n.GetChildNodes().Length == 0) { item = menu.Items.Add("Write Data"); item.Tag = n; item.Click += new EventHandler(OnWriteDataClick); } } if (menu.Items.Count > 0) { menu.Show((Control)sender, e.Location); } } }