Ejemplo n.º 1
0
        private void ListLibraries()
        {
            // Elimina todos los elementos
            while (drpSystems.ItemCount > 0)
            {
                drpSystems.RemoveAt(drpSystems.ItemCount - 1);
            }

            string activelib = _settings.GetSetting(_settingskey, "").ToLower();

            // Rellena la lista
            drpSystems.VirtualMode = true;
            foreach (DirectoryInfo subdir in _path.GetDirectories())
            {
                OTCLibrary lib = new OTCLibrary(Path.Combine(subdir.FullName, OTCLibrary.LIBRARY_FILE_NAME));

                drpSystems.AddNew();
                ((PictureBox)drpSystems.CurrentItem.Controls["picIcon"]).Image = global::otc.Properties.Resources.IMG_LIBRARY;
                drpSystems.CurrentItem.Controls["lblName"].Text        = lib.Name;
                drpSystems.CurrentItem.Controls["lblDescription"].Text = lib.Description;
                drpSystems.CurrentItem.Controls["lblVersion"].Text     = lib.Version;
                drpSystems.CurrentItem.Tag = subdir.Name;

                if (subdir.Name.ToLower().Equals(activelib))
                {
                    drpSystems.CurrentItem.BackColor = Color.FromArgb(0x55, 0xAA, 0xFF);
                    drpSystems.CurrentItem.ForeColor = Color.White;
                }
            }
        }
Ejemplo n.º 2
0
        private void btnProperties_Click(object sender, EventArgs e)
        {
            OTCLibrary lib = new OTCLibrary(Path.Combine(Path.Combine(_path.FullName, (string)drpSystems.CurrentItem.Tag), OTCLibrary.LIBRARY_FILE_NAME));

            otc.forms.frmLibraryProperties properties = new otc.forms.frmLibraryProperties(lib);
            properties.ShowDialog(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Devuelve una instancia de ControlPanelEditor.
        /// </summary>
        public PanelEditorControl()
        {
            InitializeComponent();

            _panel   = null;
            _library = null;
            // _system = null;
            _mode = PanelModes.Empty;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Devuelve una instancia de ControlPanelEditor.
        /// </summary>
        public PanelEditorControl(OTCPanel Panel, OTCLibrary Library)
        {
            InitializeComponent();

            _panel   = Panel;
            _library = Library;
            // _system = null;
            _mode = PanelModes.Design;

            Redraw();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Devuelve una instancia de ControlPanelEditor.
        /// </summary>
        public PanelEditorControl(OTCLibrary Library, OTCSystem System)
        {
            InitializeComponent();

            _panel   = null;
            _library = Library;
            // _system = System;
            _mode = PanelModes.Empty;

            Redraw();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Devuelve una instancia de frmSystemProperties.
        /// </summary>
        public frmLibraryProperties(OTCLibrary library)
        {
            InitializeComponent();

            lblName.Text        = library.Name;
            lblDescription.Text = library.Description;

            txtFile.Text     = library.Filename;
            lblElements.Text = library.Blocks.Count.ToString();
            lblVersion.Text  = library.Version;

            lblWidth.Text        = library.BlockWidth.ToString();
            lblHeight.Text       = library.BlockHeight.ToString();
            lblBgColor.Text      = "#" + library.BgColor.R + library.BgColor.G + library.BgColor.B;
            lblBgColor.BackColor = library.BgColor;

            lblAuthor.Text  = library.Author;
            lblLicence.Text = library.Licence;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Lee los sistemas desde un fichero de configuración.
        /// </summary>
        /// <param name="xmlDoc">
        /// Una instancia de <see cref="XmlDocument"/> que representa el documento XML que contiene la configuración.
        /// </param>
        private void loadThemes(XmlDocument xmlDoc)
        {
            string      path;
            XmlNodeList systems = xmlDoc.GetElementsByTagName(XML_TAG_THEME);

            foreach (XmlNode thNode in systems)
            {
                OTCLibrary theme = new OTCLibrary();
                foreach (XmlAttribute attribute in thNode.Attributes)
                {
                    switch (attribute.Name.ToLower())
                    {
                    case "name": theme.Name = attribute.Value; break;

                    case "active": theme.IsActive = (attribute.Value.Equals("1") ? true : false); break;
                    }
                }

                try
                {
                    // Carga la libreria
                    path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                    path = Path.Combine(path, OTCSettings.FOLDER_NAME);
                    path = Path.Combine(path, OTCLibrary.LIBRARY_FOLDER_NAME);
                    path = Path.Combine(path, theme.Name);
                    path = Path.Combine(path, OTCLibrary.LIBRARY_FILE_NAME);
                    theme.Load(path);

                    this._themes.Add(theme);
                }
                catch
                {
                    // Descarta la excepción
                    // TODO: Agregar la libreria "marcada" como errónea
                }
            }
        }