예제 #1
0
 private OptionControlBase configureOptionControl(OptionControlBase control, string name, string valueValue, string descr, bool required, bool used)
 {
     control.OptionName = name;
     control.Descr      = descr;
     control.valueValue = valueValue;
     control.Used       = used;                                  // for bool will override valueValue
     control.Required   = required;
     return(control);
 }
예제 #2
0
 internal void buildOptionsXml(XmlDocument xmlDoc, XmlNode node)
 {
     foreach (Control control in this.Controls)
     {
         if (control is OptionControlBase)
         {
             OptionControlBase optionControl = control as OptionControlBase;
             optionControl.addToOptionsXml(xmlDoc, node);
         }
     }
     m_textPane.addToOptionsXml(xmlDoc, node);
 }
예제 #3
0
        private string getGeneratedText()
        {
            StringBuilder ret = new StringBuilder();

            foreach (Control control in this.Controls)
            {
                if (control is OptionControlBase)
                {
                    OptionControlBase optionControl = control as OptionControlBase;
                    if (optionControl.Used)
                    {
                        ret.Append(optionControl.getGeneratedText());
                        ret.Append(",");
                    }
                }
            }
            string sRet = ret.ToString();

            if (sRet.EndsWith(","))
            {
                sRet = sRet.Substring(0, sRet.Length - 1);
            }
            return(sRet);
        }
예제 #4
0
        public void addOptionControl(XmlNode dataNode)
        {
            OptionControlBase control = null;

            string name = "";

            try
            {
                name += dataNode.Attributes.GetNamedItem("name").InnerText.Trim();
            }
            catch {}

            if ("memorized".Equals(name))
            {
                m_textPane.Memorized   = true;
                m_textPane.OptionsText = dataNode.InnerText.Trim();
                return;
            }

            string valuetype = "";

            try
            {
                valuetype += dataNode.Attributes.GetNamedItem("valuetype").InnerText.Trim();
            }
            catch {}

            string valueValue = null;

            try
            {
                valueValue = dataNode.Attributes.GetNamedItem("value").InnerText.Trim();
            }
            catch {}

            string descr = "";

            try
            {
                descr += dataNode.Attributes.GetNamedItem("descr").InnerText.Trim();
            }
            catch {}

            bool required = false;

            try
            {
                required = "true".Equals("" + dataNode.Attributes.GetNamedItem("required").InnerText.Trim());
            }
            catch {}

            bool used = false;

            try
            {
                used = "true".Equals("" + dataNode.Attributes.GetNamedItem("used").InnerText.Trim());
            }
            catch {}

            if (name.Length > 0)
            {
                switch (valuetype)
                {
                case "bool":
                    control = configureOptionControl(new OptionControlBoolean(), name, valueValue, descr, required, used);
                    break;

                case "int":
                    control = configureOptionControl(new OptionControlInteger(), name, valueValue, descr, required, used);
                    break;

                case "string":
                    control = configureOptionControl(new OptionControlString(), name, valueValue, descr, required, used);
                    break;

                case "path":
                    control = configureOptionControl(new OptionControlPath(), name, valueValue, descr, required, used);
                    break;

                default:
                    control = configureOptionControl(new OptionControlGeneral(), name, valueValue, descr, required, used);
                    break;
                }
            }

            if (control != null)
            {
                Point location = new Point(5, m_pos);
                m_pos           += m_shift;
                control.Location = location;
                control.Size     = new Size(this.Width, 20);
                control.Anchor   = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right);

                control.selectionChanged += new EventHandler(onControlSelectionChanged);

                this.Controls.Add(control);
            }
        }
예제 #5
0
 private OptionControlBase configureOptionControl(OptionControlBase control, string name, string valueValue, string descr, bool required, bool used)
 {
     control.OptionName = name;
     control.Descr = descr;
     control.valueValue = valueValue;
     control.Used = used;				// for bool will override valueValue
     control.Required = required;
     return control;
 }