Esempio n. 1
0
        public ControlFunction(string name, ICollection<string> typeOptions, ICollection<string> refOptions,
            bool isRequired, string help, GeneralControl generalControl)
            : base(name, isRequired, help, generalControl)
        {
            InitializeComponent();

            labelName.Text = name.Trim();

            if (typeOptions != null)
            {
                foreach (var s in typeOptions)
                    comboBoxType.Items.Add(s);
                SelectFunction();
                if (typeOptions.Count == 1)
                    comboBoxType.Enabled = false;
            }
            if (refOptions != null)
            {
                foreach (var s in refOptions)
                    comboBoxFunc.Items.Add(s);
                comboBoxFunc.SelectedIndex = 0;
                if (refOptions.Count == 1)
                    comboBoxFunc.Enabled = false;
            }

            if (help != null)
                toolTipHelp.SetToolTip(labelName, help);
        }
Esempio n. 2
0
 protected CustomControl(string name, bool isRequired, string help, GeneralControl generalControl)
 {
     Name = name;
     IsRequired = isRequired;
     Help = help;
     GeneralControl = generalControl;
 }
Esempio n. 3
0
        public ControlGroup(string name, bool isRequired, GeneralControl generalControl)
            : base(name, isRequired, null, generalControl)
        {
            InitializeComponent();
            labelGroup.Text = name;

            if (isRequired) labelGroup.Font = new Font(labelGroup.Font, FontStyle.Bold);
            else labelGroup.Font = new Font(labelGroup.Font, FontStyle.Regular);

            IsValid = true;
        }
Esempio n. 4
0
        public ControlKeyword(string name, IEnumerable<string> options, bool isRequired, string help, GeneralControl generalControl)
            : base(name, isRequired, help, generalControl)
        {
            InitializeComponent();

            labelName.Text = name.Trim();
            if (options != null)
            {
                foreach (var s in options)
                    comboBoxValue.Items.Add(s.Trim());
                comboBoxValue.SelectedIndex = 0;
            }

            if (help != null)
                toolTipHelp.SetToolTip(labelName, help);
        }
Esempio n. 5
0
        public ControlReference(string name, bool isRequired, string help, GeneralControl generalControl)
            : base(name, isRequired, help, generalControl)
        {
            InitializeComponent();

            labelName.Text = name.Trim();
            /* USE IN XML LOAD NOT XSD
            if (options != null)
            {

            }
            */

            if (help != null)
                toolTipHelp.SetToolTip(labelName, help);
        }
Esempio n. 6
0
        // Constructor
        /// <summary> Creates a child GroupItem from the XSD Functions file. </summary>
        /// <param name="xsdNode"> A XmlNode from the XSD Functions file. </param>
        /// <param name="parent"> The parent of this item. </param>
        /// <param name="isFunction"> Note if this is a Function. </param>
        public GroupItem(XmlNode xsdNode, GroupItem parent = null, bool isFunction = false)
            : base(xsdNode, parent, isFunction)
        {
            // Can exist multiple times?
            IsMultiple = XsdParser.IsMupltiple(xsdNode);

            // Can the user do Right-Click actions on this element?
            HasRightClickActions = XsdParser.HasRightClickActions(xsdNode);

            // Create the TreeNode of TreeViewer.
            Tnode = new TreeNode(Name) {Tag = this, ToolTipText = Help};

            SetParent(parent);

            // Children
            Children = XsdParser.CreateChildren(xsdNode, this, isFunction);

            // Create the Controls for this ElementItem with the gathered information
            Control = new GeneralControl(Name, IsRequired, Help);
        }
Esempio n. 7
0
        public ControlVariable(string name, ICollection<string> typeOptions, ICollection<string> unitOptions,
                               ICollection<string> unitXOptions, bool isRequired, string help,
                               GeneralControl generalControl)
            : base(name, isRequired, help, generalControl)
        {
            InitializeComponent();

            IsRequired = isRequired;

            labelName.Text = name.Trim();
            if (typeOptions != null)
            {
                foreach (var s in typeOptions)
                    comboBoxType.Items.Add(s);
                SelectVariable();
                if (typeOptions.Count == 1)
                    comboBoxType.Enabled = false;
            }
            if (unitXOptions != null)
            {
                foreach (var s in unitXOptions)
                    comboBoxUnit.Items.Add(s);
                comboBoxUnit.SelectedIndex = 0;
                if (unitXOptions.Count == 1)
                    comboBoxUnit.Enabled = false;
            }
            if (unitOptions != null)
            {
                foreach (var s in unitOptions)
                    comboBoxUnit2.Items.Add(s);
                comboBoxUnit2.SelectedIndex = 0;
                if (unitOptions.Count == 1)
                    comboBoxUnit2.Enabled = false;
            }

            if (help != null)
                toolTipHelp.SetToolTip(labelName, help);

            dataGridViewValue_CellValueChanged(null, null);
        }
Esempio n. 8
0
        // Constructor
        public ControlConstant(string name, List<string> typeOptions, List<string> unitOptions,
            bool isRequired, string help, GeneralControl generalControl)
            : base(name, isRequired, help, generalControl)
        {
            InitializeComponent();

            // Checks
            Debug.Assert(typeOptions != null, "Control_Constant for element {0} constructor argument typeOptions is null.", name);
            Debug.Assert(unitOptions != null, "Control_Constant for element {0} constructor argument unitOptions is null.", name);

            // Set name.
            labelName.Text = name.Trim();

            // Set possible types.
            foreach (string s in typeOptions)
                comboBoxType.Items.Add(s);

            // Since this is the control for 'Constant' type, have it selected.
            SelectConstant();

            // Visual candy.
            if (typeOptions.Count == 1)
                comboBoxType.Enabled = false;

            // Set unit.
            foreach (string s in unitOptions)
                comboBoxUnit.Items.Add(s);
            comboBoxUnit.SelectedIndex = 0;
            if (unitOptions.Count == 1)
                comboBoxUnit.Enabled = false;

            // Set help
            if (!string.IsNullOrEmpty(help))
                toolTipHelp.SetToolTip(labelName, help);

            // Red color if empty text box & required.
            textBoxValue_TextChanged(null, null);
        }
Esempio n. 9
0
        private void CreateGeneralControl(ComplexType complexType)
        {
            var list = new List<CustomControlType>();

            // Possible Options
            List<string> typeOptions = complexType.GetTypeOptions();//Constant/Variable/Function
            List<string> unitOptions = null;                        //Constant/Variable
            List<string> xUnitOptions = null;                       //Variable
            List<string> functionOptions = null;                    //Function
            List<string> keyOptions = null;                         //Keyword
            // Reference Options cannot be gathered during XSD Load.//Reference

            // Default values
            var defaultValues = new Dictionary<CustomControlType, string>();
            string defaultUnitValue = null;
            string defaultXUnitValue = null;

            //Gather information for the controls creation
            unitOptions = complexType.GetUnitOptions();
            xUnitOptions = complexType.GetX_UnitOptions();
            functionOptions = complexType.GetFunctionNames();
            keyOptions = complexType.GetKeywordOptions();

            // Handle types selection on this element
            if (complexType.Constant != null)
            {
                list.Add(CustomControlType.Constant);
                defaultValues[CustomControlType.Constant] = complexType.Constant.DefaultValue;
                defaultUnitValue = complexType.Constant.DefaultUnit;
            }
            if (complexType.Variable != null)
            {
                list.Add(CustomControlType.Variable);
                defaultValues[CustomControlType.Variable] = complexType.Variable.DefaultValue;
                defaultUnitValue = complexType.Variable.DefaultUnit;
                defaultXUnitValue = complexType.Variable.DefaultXUnit;
            }
            if (complexType.Function != null)
            {
                list.Add(CustomControlType.Function);
            }
            if (complexType.Keyword != null)
            {
                list.Add(CustomControlType.Keyword);
                defaultValues[CustomControlType.Keyword] = complexType.Keyword.DefaultValue;
            }
            if (complexType.Reference != null)
            {
                list.Add(CustomControlType.Reference);
            }

            // Create the Controls for this ElementItem with the gathered information.
            Control = new GeneralControl(Name, IsRequired, Help, list,
                typeOptions, unitOptions, xUnitOptions, functionOptions, keyOptions,
                defaultValues, defaultUnitValue, defaultXUnitValue,
                ValidateAndSave, SaveVariable, SelectType, UnitChange, XUnitChange);
        }