Esempio n. 1
0
 /// <summary>
 /// Gets the PanelContainers manager for the specified document runtime
 /// serial number.
 /// </summary>
 /// <param name="docSerialNumber"></param>
 /// <returns></returns>
 public PanelContainers Containers(uint docSerialNumber)
 {
     // If the PanelType is PanelType.System then use the non document specific
     // container object
     if (PanelType == PanelType.System)
     {
         return(m_system_containers);
     }
     // Check to see if there is an document specific existing containers object
     m_document_containers.TryGetValue(docSerialNumber, out PanelContainers container);
     // If none found then add one
     if (container == null)
     {
         m_document_containers[docSerialNumber] = (container = new PanelContainers());
     }
     return(container);
 }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="plugInId"></param>
        /// <param name="type"></param>
        /// <param name="englishCaption"></param>
        /// <param name="localCaption"></param>
        /// <param name="icon"></param>
        /// <param name="panelType"></param>
        internal PanelDefinition(Guid plugInId, Type type, string englishCaption, string localCaption, Icon icon, PanelType panelType)
        {
            PlugInId       = plugInId;
            Id             = type.GUID;
            Type           = type;
            EnglishCaption = englishCaption;
            LocalCaption   = localCaption;
            Icon           = icon;
            PanelType      = panelType;
            switch (panelType)
            {
            case PanelType.PerDoc:
                m_document_containers = new Dictionary <uint, PanelContainers>();
                break;

            case PanelType.System:
                m_system_containers = new PanelContainers();
                break;
            }
        }
Esempio n. 3
0
        public void LoadControls(String panelName)
        {
            //Cargamos la configuracion
            var configuracion = ProyectoCraft.Base.Configuracion.Configuracion.Instance();
            var opcion        = configuracion.GetValue("Semaforos_Brasil_Enabled"); //puede retornar un true, false o null

            var pathxml = "";

            Path = opcion.HasValue && opcion.Value.Equals(true) ? @"panel de control/Brasil" : @"panel de control/Chile";

            pathxml = System.IO.Path.Combine(Application.StartupPath, string.Format(
                                                 @Path + "/panel de control/{0}", panelName));

            var xmldoc = new XmlDocument();

            xmldoc.Load(pathxml);

            var panelNodes = xmldoc.SelectNodes("/panel/panel");

            foreach (XmlNode panelNode in panelNodes)
            {
                var size = new Size(Convert.ToInt16(panelNode.Attributes["width"].Value),
                                    Convert.ToInt16(panelNode.Attributes["heigth"].Value));
                var location = new Point(Convert.ToInt16(panelNode.Attributes["x"].Value),
                                         Convert.ToInt16(panelNode.Attributes["y"].Value));

                var panelContainer = new PanelContainer(panelNode.Attributes["title"].Value, location, size);

                var xmlnodes = panelNode.SelectNodes("control");
                foreach (XmlNode xmlnode in xmlnodes)
                {
                    if (!String.IsNullOrEmpty(xmlnode.InnerText.Trim()))
                    {
                        MyControl myControl       = null;
                        var       xmldocControles = new XmlDocument();
                        xmldocControles.Load(System.IO.Path.Combine(Application.StartupPath, string.Format(
                                                                        @Path + "/controles/{0}", xmlnode.InnerText.Trim())));
                        var TypeOfControl = xmldocControles.SelectSingleNode("/control").Attributes["type"].Value;
                        size = new Size(Convert.ToInt16(xmlnode.Attributes["width"].Value),
                                        Convert.ToInt16(xmlnode.Attributes["heigth"].Value));
                        location = new Point(Convert.ToInt16(xmlnode.Attributes["x"].Value),
                                             Convert.ToInt16(xmlnode.Attributes["y"].Value));
                        switch (TypeOfControl.ToUpper())
                        {
                        case "DIGITALGAUGE":
                            myControl = new DigitalGauge(xmldocControles, location, size);
                            break;

                        case "LINEARGAUGE":
                            myControl = new LinearGauge(xmldocControles, location, size);
                            break;

                        case "SEMAFORO":
                            myControl = new Semaforo(xmldocControles, location, size);
                            break;

                        case "GRAFICOBARRA3D":
                            myControl = new GraficoBarra3D(xmldocControles, location, size);
                            break;

                        case "SEMAFORO_V2":
                            myControl = new SemaforoV2(xmldocControles, location, size);
                            break;
                        }
                        if (myControl != null)
                        {
                            panelContainer.Controles.Add(myControl);
                        }
                    }
                }
                PanelContainers.Add(panelContainer);
            }
        }