Esempio n. 1
0
        /// <summary>
        /// This event deletes a selected node.
        /// </summary>
        /// <param name="sender">
        /// Name of the object.
        /// </param>
        /// <param name="e">
        /// This class contains no event data; it is used by events that do not pass state information to an event
        /// handler when an event is raised. If the event handler requires state information, the application must
        /// derive a class from this class to hold the data.
        /// </param>
        public void clickMenuRemoveSCL(object sender, EventArgs e)
        {
            WindowTreeViewLNType windowTreeViewLNType;

            OpenSCL.Object sCL = new OpenSCL.Object();
            sCL.Configuration = (SCL)this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Tag;
            if (!this.treeSCL.TreeView.SelectedNode.Tag.GetType().Equals(typeof(SCL)))
            {
                switch (this.treeSCL.TreeView.SelectedNode.Tag.GetType().Name)
                {
                case "tDOI[]":
                case "tDOI":
                case "tDAI[]":
                case "tDAI":
                case "tSDI[]":
                case "tSDI":
                case "tVal[]":
                case "tVal":
                    this.treeSCL = this.treeViewSCL.SearchUPForBaseTypeAndGetSCLTreeNode(this.treeSCL.TreeView.SelectedNode, (typeof(tAnyLN)));
                    if (this.treeSCL != null)
                    {
                        windowTreeViewLNType = new WindowTreeViewLNType(this.treeSCL, sCL.Configuration, this.treeSCL.Tag, "Edit");
                        windowTreeViewLNType.ReloadLNType();
                        windowTreeViewLNType.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("It doesn't load the class");
                    }
                    break;

                case "tGSEControl":
                    treeViewSCL.RemoveGSEandSMV(this.treeSCL, this.objectManagement.FindVariable(this.treeSCL.TreeView.SelectedNode.Tag, "name").ToString(), "tGSE");
                    break;

                case "tSampledValueControl":
                    treeViewSCL.RemoveGSEandSMV(this.treeSCL, this.objectManagement.FindVariable(this.treeSCL.TreeView.SelectedNode.Tag, "name").ToString(), "tSMV");
                    break;

                default:
                    if (MessageBox.Show("Warning!, Do you want to remove this node?", "Removing Node", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly, false) == DialogResult.Yes)
                    {
                        AutomataForValidateToTreeNode automataForValidateToTreeNode;
                        RegularExpressionTree         regularExpressionTree = new RegularExpressionTree();
                        automataForValidateToTreeNode = new AutomataForValidateToTreeNode(this.treeSCL.TreeView.SelectedNode, regularExpressionTree.GetRegExpToDelete(this.treeSCL.TreeView.SelectedNode));
                        automataForValidateToTreeNode.InterpretString();
                    }
                    break;
                }
            }
            else
            {
                MessageBox.Show("Warning!, The SCL node can not be removed!!!");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// This event edit a selected node.
 /// </summary>
 /// <param name="sender">
 /// Name of the object.
 /// </param>
 /// <param name="e">
 /// This class contains no event data; it is used by events that do not pass state information to an event
 /// handler when an event is raised. If the event handler requires state information, the application must
 /// derive a class from this class to hold the data.
 /// </param>
 private void EditOption_Click(object sender, EventArgs e)
 {
     OpenSCL.Object sCL = new OpenSCL.Object();
     sCL.Configuration = (SCL)this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Tag;
     if (treeSCL.Tag is tPrivate)
     {
         PrivateDialog windowsPrivate = new PrivateDialog(treeSCL.Tag as tPrivate);
         if (windowsPrivate.ShowDialog() == DialogResult.OK)
         {
             Changed(this, EventArgs.Empty);
         }
     }
     else if (treeSCL.Tag is tAnyLN)
     {
         WindowTreeViewLNType windowTreeViewLNType = new WindowTreeViewLNType(this.treeSCL, sCL.Configuration, this.treeSCL.Tag, "Edit");
         windowTreeViewLNType.ReloadLNType();
         if (windowTreeViewLNType.ShowDialog() == DialogResult.OK)
         {
             Changed(this, EventArgs.Empty);
         }
     }
     else if (treeSCL.Tag is tDataSet)
     {
         DataSetDialog windowDataSet = new DataSetDialog();
         windowDataSet.ReloadDataSet(treeSCL, sCL.Configuration);
         if (windowDataSet.ShowDialog() == DialogResult.OK)
         {
             Changed(this, EventArgs.Empty);
         }
     }
     else if (treeSCL.Tag is tGSEControl)
     {
         tGSEControl  cgse   = (tGSEControl)this.treeSCL.TreeView.SelectedNode.Tag;
         tLDevice     ld     = (tLDevice)this.treeSCL.TreeView.SelectedNode.Parent.Parent.Parent.Tag;
         tAccessPoint ap     = (tAccessPoint)this.treeSCL.TreeView.SelectedNode.Parent.Parent.Parent.Parent.Parent.Parent.Tag;
         tIED         ied    = (tIED)this.treeSCL.TreeView.SelectedNode.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Tag;
         GSEDialog    gseDlg = new GSEDialog(this.treeViewSCL,
                                             this.treeSCL.TreeView.SelectedNode,
                                             ied, ap, ld, cgse);
         if (gseDlg.ShowDialog() == DialogResult.OK)
         {
             Changed(this, EventArgs.Empty);
         }
     }
     else if (treeSCL.Tag is tSampledValueControl)
     {
         object opt = null;
         if (this.treeSCL.TreeView.SelectedNode.FirstNode != null)
         {
             opt = this.treeSCL.TreeView.SelectedNode.FirstNode.Tag;
         }
         if (this.treeViewSCL.getDataset(this.treeSCL).Count == 0)
         {
             MessageBox.Show("The SCL file should have at least one DataSet configured on this Device",
                             "Warnning",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Exclamation);
         }
         else
         {
             SMVDialog smvDlg = new SMVDialog(this.treeSCL, this.objectManagement.FindVariable(this.treeSCL.TreeView.SelectedNode.Parent.Parent.Parent.Parent.Parent.Parent.Tag, "name").ToString(),
                                              this.objectManagement.FindVariable(this.treeSCL.TreeView.SelectedNode.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Tag, "name").ToString(),
                                              this.treeSCL.TreeView.SelectedNode.Tag, opt,
                                              this.objectManagement.FindVariable(this.treeSCL.TreeView.SelectedNode.Parent.Parent.Parent.Tag, "inst").ToString());             //victor
             if (smvDlg.ShowDialog() == DialogResult.OK)
             {
                 Changed(this, EventArgs.Empty);
             }
         }
     }
 }