Exemplo n.º 1
0
        /// <summary>
        /// This method reload the values of a DataSet that was previously created.
        /// </summary>
        /// <param name="treeDataSet">
        /// TreeNode of the selected DataSet.
        /// </param>
        /// <param name="sCL">
        /// sCL object that contains the data assigned to the selected DataSet.
        /// </param>
        public void ReloadDataSet(TreeNode treeDataSet, SCL sCL)
        {
            this.bandModify = true;
            this.scl        = sCL;
            this.treeSCL    = treeDataSet;
            tDataSet dataSetSCLDestiny = (tDataSet)treeDataSet.Tag;
            tDataSet dataSetSCLSource;

            this.NameTextBox.Text = dataSetSCLDestiny.name;
            this.DescTextBox.Text = dataSetSCLDestiny.desc;
            this.anyLN            = this.treeViewSCL.SearchUPForBaseTypeAndGetSCLTreeNode(treeDataSet, typeof(tAnyLN)).Tag;
            DataSet dataSet = new DataSet();

            this.node = this.treeViewSCL.SearchUPForTypeAndGetSCLTreeNode(treeDataSet, typeof(tLDevice));
            if (this.node != null)
            {
                this.Name = "ldInst" + (node.Tag as tLDevice).inst;
                if (this.anyLN is tLN)
                {
                    this.LNtypeLabel.Text = ((anyLN as tLN).prefix + (anyLN as tLN).lnClass + (anyLN as tLN).inst);
                    dataSetSCLSource      = dataSet.GetLNFCDAs(node.Tag as tLDevice, this.anyLN as tLN, this.scl.DataTypeTemplates);
                }
                else
                {
                    this.LNtypeLabel.Text = ((anyLN as LN0).lnClass + (anyLN as LN0).inst);
                    dataSetSCLSource      = dataSet.GetLN0FCDAs(node.Tag as tLDevice, this.anyLN as LN0, this.scl.DataTypeTemplates);
                }
                for (int x = 0, y = 0; dataSetSCLSource != null && dataSetSCLSource.FCDA != null && x < dataSetSCLSource.FCDA.Length; x++)
                {
                    if (dataSetSCLDestiny != null && dataSetSCLDestiny.FCDA != null && y < dataSetSCLDestiny.FCDA.Length && this.objectManagement.Compare(dataSetSCLSource.FCDA[x], dataSetSCLDestiny.FCDA[y]))
                    {
                        this.DestinyDataSetListBox.Items.Add(new FCDAListBox(dataSetSCLDestiny.FCDA[y], (this.anyLN as tAnyLN).lnType));
                        y++;
                    }
                    else
                    {
                        this.SourceDataSetListBox.Items.Add(new FCDAListBox(dataSetSCLSource.FCDA[x], (this.anyLN as tAnyLN).lnType));
                    }
                }
            }
            else
            {
                this.LNtypeLabel.Text = ((anyLN as tLN).prefix + (anyLN as tLN).lnClass + (anyLN as tLN).inst);
                dataSetSCLSource      = dataSet.GetLNFCDAs(null, this.anyLN as tLN, this.scl.DataTypeTemplates);
                for (int x = 0, y = 0; dataSetSCLSource != null && dataSetSCLSource.FCDA != null && x < dataSetSCLSource.FCDA.Length; x++)
                {
                    if (dataSetSCLDestiny != null && dataSetSCLDestiny.FCDA != null && y < dataSetSCLDestiny.FCDA.Length && this.objectManagement.Compare(dataSetSCLSource.FCDA[x], dataSetSCLDestiny.FCDA[y]))
                    {
                        this.DestinyDataSetListBox.Items.Add(new FCDAListBox(dataSetSCLDestiny.FCDA[y], (this.anyLN as tAnyLN).lnType));
                        y++;
                    }
                    else
                    {
                        this.SourceDataSetListBox.Items.Add(new FCDAListBox(dataSetSCLSource.FCDA[x], (this.anyLN as tAnyLN).lnType));
                    }
                }
            }
            this.SourceDataSetListBox.DisplayMember  = "DisplayFCDA";
            this.DestinyDataSetListBox.DisplayMember = "DisplayFCDA";
        }
Exemplo n.º 2
0
        public DataSetNode(tDataSet ds)
        {
            if (ds == null)
            {
                return;
            }

            Name = ds.name;
            Tag  = ds;
            if (ds.FCDA != null)
            {
                for (int i = 0; i < ds.FCDA.Length; i++)
                {
                    var n = new FcdaNode(ds.FCDA[i]);
                    Nodes.Add(n);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method creates a DataSet.
        /// </summary>
        /// <param name="treeSCL">
        /// TreeNode that contains the DataSet object.
        /// </param>
        /// <param name="sCLObject">
        /// sCL object of the project.
        /// </param>
        public void CreateDataSet(TreeNode treeSCL, SCL sCLObject)
        {
            this.treeSCL = treeSCL;
            this.scl     = sCLObject;
            this.anyLN   = this.treeViewSCL.SearchUPForBaseTypeAndGetSCLTreeNode(treeSCL, typeof(tAnyLN)).Tag;
            this.node    = this.treeViewSCL.SearchUPForTypeAndGetSCLTreeNode(treeSCL, typeof(tLDevice));
            DataSet dataSet = new DataSet();

            if (this.node != null)
            {
                this.Name = "ldInst" + (node.Tag as tLDevice).inst;
                if (this.anyLN is tLN)
                {
                    this.LNtypeLabel.Text = ((anyLN as tLN).prefix + (anyLN as tLN).lnClass + (anyLN as tLN).inst);
                    this.dataSetSCL       = dataSet.GetLNFCDAs(node.Tag as tLDevice, this.anyLN as tLN, this.scl.DataTypeTemplates);
                }
                else
                {
                    this.LNtypeLabel.Text = ((anyLN as LN0).lnClass + (anyLN as LN0).inst);
                    this.dataSetSCL       = dataSet.GetLN0FCDAs(node.Tag as tLDevice, this.anyLN as LN0, this.scl.DataTypeTemplates);
                }
                for (int x = 0; this.dataSetSCL != null && this.dataSetSCL.FCDA != null && x < this.dataSetSCL.FCDA.Length; x++)
                {
                    this.SourceDataSetListBox.Items.Add(new FCDAListBox(this.dataSetSCL.FCDA[x], (this.anyLN as tAnyLN).lnType));
                }
            }
            else
            {
                this.LNtypeLabel.Text = ((anyLN as tLN).prefix + (anyLN as tLN).lnClass + (anyLN as tLN).inst);
                this.dataSetSCL       = dataSet.GetLNFCDAs(null, this.anyLN as tLN, this.scl.DataTypeTemplates);
                for (int x = 0; this.dataSetSCL != null && this.dataSetSCL.FCDA != null && x < this.dataSetSCL.FCDA.Length; x++)
                {
                    this.SourceDataSetListBox.Items.Add(new FCDAListBox(this.dataSetSCL.FCDA[x], (this.anyLN as tLN).lnType));
                }
            }
            this.SourceDataSetListBox.SelectionMode  = SelectionMode.None;
            this.DestinyDataSetListBox.SelectionMode = SelectionMode.None;
            this.SourceDataSetListBox.SelectionMode  = SelectionMode.MultiSimple;
            this.DestinyDataSetListBox.SelectionMode = SelectionMode.MultiSimple;
            this.SourceDataSetListBox.DisplayMember  = "DisplayFCDA";
            this.DestinyDataSetListBox.DisplayMember = "DisplayFCDA";
        }
Exemplo n.º 4
0
 /// <summary>
 /// This event saves the information of the DataSet.
 /// </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 OKButtonClick(object sender, EventArgs e)
 {
     if (this.DestinyDataSetListBox.Items.Count > 0)
     {
         this.treeSCL.TreeView.SelectedNode = this.treeViewSCL.SearchUPForBaseTypeAndGetSCLTreeNode(treeSCL, typeof(tAnyLN));
         object lN = this.treeSCL.TreeView.SelectedNode.Tag;
         if (this.dataSetSCL != null)
         {
             this.dataSetSCL.FCDA = null;
         }
         else
         {
             this.dataSetSCL = new tDataSet();
         }
         tFCDA[] fCDAs = new tFCDA[this.DestinyDataSetListBox.Items.Count];
         for (int x = 0; x < this.DestinyDataSetListBox.Items.Count; x++)
         {
             fCDAs[x] = (this.DestinyDataSetListBox.Items[x] as FCDAListBox).fCDA;
         }
         this.dataSetSCL.FCDA = fCDAs;
         this.dataSetSCL.name = this.NameTextBox.Text;
         this.dataSetSCL.desc = this.DescTextBox.Text;
         this.objectManagement.AddObjectToArrayObjectOfParentObject(this.dataSetSCL, lN);
         treeViewSCL.GetNodesItemOfArray((lN as tAnyLN).DataSet, lN.GetType(), this.treeSCL.TreeView.SelectedNode);
         if (this.bandModify)
         {
             RegularExpressionTree         regularExpressionTree         = new  RegularExpressionTree();
             AutomataForValidateToTreeNode automataForValidateToTreeNode = new AutomataForValidateToTreeNode(this.treeSCL,
                                                                                                             regularExpressionTree.GetRegExpToDelete(this.treeSCL));
             automataForValidateToTreeNode.InterpretString();
         }
         this.Close();
     }
     else
     {
         MessageBox.Show("No data has been added to the DataSet");
     }
 }
Exemplo n.º 5
0
 public DataSet()
 {
     this.dataSet = new tDataSet();
 }