private void createLibrary(LibraryInfo info, ITcSmTreeItem plcProject, IWorker worker)
        {
            worker.ProgressStatus = string.Format("Adding Library '{0}' ...", info.LibraryName);

            ITcSmTreeItem        referencesItem = plcProject.LookupChild("References");
            ITcPlcLibraryManager libraryManager = (ITcPlcLibraryManager)referencesItem;

            libraryManager.AddLibrary(info.LibraryName);
        }
Esempio n. 2
0
        /* ===============================================================================================
         * Helper method to iterate over all child nodes of Plc\PlcObjects in Orders.xml
         * =============================================================================================== */
        private void addPlcElements(ref List <PlcObjectInfo> list, XmlNodeList xmlElements)
        {
            if (xmlElements != null)
            {
                foreach (XmlElement element in xmlElements)
                {
                    PlcObjectType type = (PlcObjectType)Enum.Parse(typeof(PlcObjectType), element.Attributes["type"].Value);
                    PlcObjectInfo info = null;

                    switch (type)
                    {
                    case PlcObjectType.Library:
                        info = new LibraryInfo(element);
                        break;

                    case PlcObjectType.Placeholder:
                        info = new PlaceholderInfo(element);
                        break;

                    case PlcObjectType.DataType:
                        info = new DataTypeInfo(element);
                        break;

                    case PlcObjectType.POU:
                        info = new POUInfo(element);
                        break;

                    case PlcObjectType.Itf:
                        info = new ItfInfo(element);
                        break;

                    case PlcObjectType.Gvl:
                        info = new GvlInfo(element);
                        break;

                    default:
                        Debug.Fail("");
                        break;
                    }

                    if (info != null)
                    {
                        list.Add(info);
                    }
                }
            }
        }