Example #1
0
 /// <summary>
 /// This method creates the FCDA for the DA of the SDO data.
 /// </summary>
 /// <param name="dataTypeTemplates">
 /// DataTypeTemplates Node of the SCL project. This node is used to create and assign the information
 /// to the Logical Node.
 /// </param>
 /// <param name="dOType">
 /// DA information where their names will be gotten and are necessaries for the creation of the FCDAs.
 /// </param>
 /// <param name="doName">
 /// DO name that contains the DA used to create the FCDA.
 /// </param>
 /// <param name="daNameParent">
 /// SDO name that contains the DA used to create the FCDA.
 /// </param>
 private void InsertDaNameParent(tDataTypeTemplates dataTypeTemplates, tDOType dOType, string doName, string daNameParent)
 {
     // The variable "d" is the index of the DA (Don't change this class!!)
     for (int d = 0; d < dOType.DA.Length; d++)
     {
         if (dOType.DA[d].bTypeEnum == tBasicTypeEnum.Struct)
         {
             // The variable "e" is the index of the DA (This class can be modified)
             for (int e = 0; e < dataTypeTemplates.DAType.Length; e++)
             {
                 if (dOType.DA[d].type.Equals(dataTypeTemplates.DAType[e].id))
                 {
                     tFCDA fCDA = new tFCDA();
                     fCDA.ldInst  = this.ldInst;
                     fCDA.prefix  = this.prefix;
                     fCDA.lnClass = this.lnClass;
                     fCDA.lnInst  = this.lnInst;
                     fCDA.doName  = doName;
                     fCDA.daName  = daNameParent + "." + dOType.DA[d].name;
                     if (this.ldevice != null)
                     {
                         //fCDA.LDevice = this.tLDevice;
                         //this.objectManagement.FindVariableAndSetValue(fCDA, this.tLDevice.GetType().Name, this.tLDevice);
                     }
                     dataSet.AddFCDA(fCDA);
                     //this.objectManagement.AddObjectToArrayObjectOfParentObject(fCDA, dataSet);
                     this.InsertDaNameParent(dataTypeTemplates, ref e, doName, daNameParent + "." + dOType.DA[d].name);
                     break;
                 }
             }
         }
         else
         {
             tFCDA fCDA = new tFCDA();
             fCDA.ldInst  = this.ldInst;
             fCDA.prefix  = this.prefix;
             fCDA.lnClass = this.lnClass;
             fCDA.lnInst  = this.lnInst;
             fCDA.doName  = doName;
             fCDA.daName  = daNameParent + "." + dOType.DA[d].name;
             if (this.ldevice != null)
             {
                 //fCDA.LDevice = this.tLDevice;
                 //this.objectManagement.FindVariableAndSetValue(fCDA, this.tLDevice.GetType().Name, this.tLDevice);
             }
             dataSet.AddFCDA(fCDA);
             //this.objectManagement.AddObjectToArrayObjectOfParentObject(fCDA, dataSet);
         }
     }
 }
Example #2
0
        public DataObjectTypeNode(tDOType dot)
        {
            if (dot == null)
            {
                return;
            }
            Tag = dot;
            update_name();
            dot.PropertyChanged += new PropertyChangedEventHandler(on_changed);
            var cxm    = new System.Windows.Forms.ContextMenuStrip();
            var add_da = new System.Windows.Forms.ToolStripMenuItem("Add Attribute", null,
                                                                    on_add_da);
            var add_sdo = new System.Windows.Forms.ToolStripMenuItem("Add Object Attribute", null,
                                                                     on_add_sdo);

            cxm.Items.Add(add_da);
            cxm.Items.Add(add_sdo);
            base.ContextMenuStrip = cxm;
            update_nodes();
        }