コード例 #1
0
        public static FlowLayoutPanel RadioButtonFlow(IXsdPart part, string defaultSelected = "", ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var panel = Container(part, tooltip);
                panel.SuspendLayout();

                var container = new FlowLayoutPanel();
                container.SuspendLayout();
                container.FlowDirection = FlowDirection.LeftToRight;
                container.AutoSize      = true;
                container.Font          = Methods.BaseFont;
                container.Name          = "container" + part.Name;
                container.Size          = new System.Drawing.Size(208, 53);

                //true false
                string selected = !String.IsNullOrWhiteSpace(part.Value) ? part.Value : defaultSelected;

                container.Controls.Add(Controls.RadioButton(part, "True", selected, tooltip));
                container.Controls.Add(Controls.RadioButton(part, "False", selected, tooltip));
                container.ResumeLayout();
                panel.Controls.Add(container);
                panel.ResumeLayout();
                return(panel);
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        /// Method that returns checks the SpecialLengthNames list to see which parts should be set to a specific length.
        /// </summary>
        /// <param name="part">The Attribute or Element.</param>
        /// <returns>Whether or not to use the static length.</returns>
        public static bool SpecialLength(IXsdPart child, IXsdPart parent)
        {
            if (child.SpecialLength)
            {
                return(true);
            }

            string validName = "";

            if (parent != null)
            {
                validName = parent.Name + "." + child.Name;
            }
            else
            {
                validName = child.Name;
            }

            if (SpecialLengthNames.Contains(validName))
            {
                return(true);
            }

            return(false);
        }
コード例 #3
0
        public static TextBox Numeric(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var numeric = new TextBox();
                numeric.SuspendLayout();
                numeric.ForeColor   = System.Drawing.Color.Black;
                numeric.BorderStyle = BorderStyle.FixedSingle;
                numeric.Font        = Methods.BaseFont;
                numeric.Size        = new System.Drawing.Size(60, 21);
                //numeric.Minimum = 0;
                //numeric.Maximum = 65000;
                numeric.Name      = "n" + part.Name;
                numeric.Text      = String.IsNullOrWhiteSpace(part.Value) ? "" : part.Value;
                numeric.Tag       = part;
                numeric.KeyPress += SpecialCaseHandlers.NumericNumberFilter;
                numeric.ResumeLayout();

                if (tooltip != null)
                {
                    tooltip.SetToolTip(numeric, part.Documentation);
                }

                return(numeric);
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return(null);
            }
        }
コード例 #4
0
        /// <summary>
        /// Method that uses the IsAdvancedNames list to determine if something should be hidden.
        /// </summary>
        /// <param name="part">The Attribute or Element.</param>
        /// <returns>Returns true to hide something and false to show.</returns>
        public static bool IsAdvanced(IXsdPart child, IXsdPart parent)
        {
            var parentName = parent != null ? parent.Name : "";
            var name       = child.Name + "." + parentName;

            if (IsAdvancedNames.Contains(name) || child.Documentation.ToLower().Contains("deprecated"))
            {
                return(true);
            }
            return(false);
        }
コード例 #5
0
        public static TextBox TextBox(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var textBox = new TextBox();
                textBox.SuspendLayout();
                textBox.BackColor   = System.Drawing.Color.White;
                textBox.ForeColor   = System.Drawing.Color.Black;
                textBox.BorderStyle = BorderStyle.FixedSingle;
                textBox.Font        = Methods.BaseFont;
                textBox.Name        = "t" + part.Name;

                if (String.IsNullOrWhiteSpace(part.Value) && !Methods.StandAloneElement(part))
                {
                    textBox.Text = (part as Parts.Attribute).Default;
                }
                else
                {
                    textBox.Text = part.Value;
                }

                //Some textboxes will be empty but need to contain long strings.
                if (part.SpecialLength)
                {
                    textBox.Size = new System.Drawing.Size(200, 21);
                }
                else
                {
                    textBox.Size = new System.Drawing.Size(Methods.Width(textBox.Text), 21);
                }

                if (tooltip != null)
                {
                    tooltip.SetToolTip(textBox, part.Documentation);
                }

                textBox.Tag = part;

                textBox.ResumeLayout();
                return(textBox);
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return(null);
            }
        }
コード例 #6
0
        public static bool StandAloneElement(IXsdPart part)
        {
            if ((part as Parts.Attribute) != null)
            {
                return(false);
            }

            Parts.Element element = part as Parts.Element;
            if (element.Elements.Count == 0 && element.Type.Contains("string"))
            {
                return(true);
            }

            return(false);
        }
コード例 #7
0
        public static FlowLayoutPanel Container(IXsdPart part, ToolTip tooltip = null)
        {
            var panel = new FlowLayoutPanel();
            panel.SuspendLayout();
            panel.FlowDirection = FlowDirection.TopDown;
            panel.AutoSize = true;
            panel.Font = Methods.BaseFont;
            panel.Name = "p" + part.Name;
            panel.Size = new System.Drawing.Size(208, 53);
            panel.AutoSize = true;

            //panel.BorderStyle = BorderStyle.Fixed3D;
            panel.BorderStyle = BorderStyle.None;

            panel.Controls.Add(Controls.Label(part, tooltip));
            panel.ResumeLayout();
            return panel;
        }
コード例 #8
0
        public static FlowLayoutPanel Container(IXsdPart part, ToolTip tooltip = null)
        {
            var panel = new FlowLayoutPanel();

            panel.SuspendLayout();
            panel.FlowDirection = FlowDirection.TopDown;
            panel.AutoSize      = true;
            panel.Font          = Methods.BaseFont;
            panel.Name          = "p" + part.Name;
            panel.Size          = new System.Drawing.Size(208, 53);
            panel.AutoSize      = true;

            //panel.BorderStyle = BorderStyle.Fixed3D;
            panel.BorderStyle = BorderStyle.None;

            panel.Controls.Add(Controls.Label(part, tooltip));
            panel.ResumeLayout();
            return(panel);
        }
コード例 #9
0
 public static FlowLayoutPanel NumericFlow(IXsdPart part, ToolTip tooltip = null)
 {
     try
     {
         if (String.IsNullOrWhiteSpace(part.Name))
         {
             throw new ArgumentNullException();
         }
         var panel = Container(part);
         panel.SuspendLayout();
         panel.Controls.Add(Controls.Numeric(part, tooltip));
         panel.ResumeLayout();
         return panel;
     }
     catch (Exception ex)
     {
         return null;
     }
 }
コード例 #10
0
        public static Button MenuButton(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var button = new Button();
                button.SuspendLayout();
                //button.AutoSize = true;
                button.BackColor = System.Drawing.Color.FromArgb(234, 234, 234);
                button.FlatAppearance.BorderSize         = 0;
                button.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
                button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
                button.FlatStyle = FlatStyle.Flat;
                button.Font      = Methods.BaseFont;
                button.UseVisualStyleBackColor = false;
                button.Size      = new System.Drawing.Size(152, 23);
                button.Margin    = new Padding(0, 0, 0, 0);
                button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                button.Name      = "b" + part.Name;
                button.Text      = part.Name;
                button.Tag       = part;

                if (tooltip != null)
                {
                    tooltip.SetToolTip(button, part.Documentation);
                }

                button.Click      += Methods.MenuButton_Click;
                button.MouseEnter += Methods.MenuButton_MouseEnter;
                button.MouseLeave += Methods.MenuButton_MouseLeave;

                button.ResumeLayout();
                return(button);
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return(null);
            }
        }
コード例 #11
0
 public static FlowLayoutPanel NumericFlow(IXsdPart part, ToolTip tooltip = null)
 {
     try
     {
         if (String.IsNullOrWhiteSpace(part.Name))
         {
             throw new ArgumentNullException();
         }
         var panel = Container(part);
         panel.SuspendLayout();
         panel.Controls.Add(Controls.Numeric(part, tooltip));
         panel.ResumeLayout();
         return(panel);
     }
     catch (Exception ex)
     {
         log.Debug(ex);
         return(null);
     }
 }
コード例 #12
0
        public static RadioButton RadioButton(IXsdPart part, string text, string selected, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name) || String.IsNullOrWhiteSpace(text))
                {
                    throw new ArgumentNullException();
                }
                var radioButton = new RadioButton();
                radioButton.SuspendLayout();
                radioButton.ForeColor = System.Drawing.Color.Black;
                radioButton.AutoSize  = true;
                radioButton.Font      = Methods.BaseFont;
                radioButton.UseVisualStyleBackColor = true;
                radioButton.Size    = new System.Drawing.Size(98, 17);
                radioButton.TabStop = true;
                radioButton.Text    = text;
                radioButton.Name    = "rb" + part.Name + text;
                radioButton.Tag     = part;

                if (selected == text.ToLower())
                {
                    radioButton.Checked = true;
                }

                if (tooltip != null)
                {
                    tooltip.SetToolTip(radioButton, part.Documentation);
                }

                radioButton.ResumeLayout();
                return(radioButton);
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return(null);
            }
        }
コード例 #13
0
        public static Label Label(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var label = new Label();
                label.SuspendLayout();
                label.ForeColor = System.Drawing.Color.Black;
                label.AutoSize = true;
                label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                label.Font = Methods.BaseFont;
                label.Size = new System.Drawing.Size(41, 13);
                label.Text = part.Name;
                label.Name = "l" + part.Name;

                if (tooltip != null)
                {
                    tooltip.SetToolTip(label, part.Documentation);
                }

                if (part.Name == "HeaderLabel")
                {
                    label.Visible = false;
                    label.Margin = new Padding(0, 0, 0, 10);
                }

                label.ResumeLayout();
                return label;
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return null;
            }
        }
コード例 #14
0
        public static Label Label(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var label = new Label();
                label.SuspendLayout();
                label.ForeColor = System.Drawing.Color.Black;
                label.AutoSize  = true;
                label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                label.Font      = Methods.BaseFont;
                label.Size      = new System.Drawing.Size(41, 13);
                label.Text      = part.Name;
                label.Name      = "l" + part.Name;

                if (tooltip != null)
                {
                    tooltip.SetToolTip(label, part.Documentation);
                }

                if (part.Name == "HeaderLabel")
                {
                    label.Visible = false;
                    label.Margin  = new Padding(0, 0, 0, 10);
                }

                label.ResumeLayout();
                return(label);
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return(null);
            }
        }
コード例 #15
0
        public static bool StandAloneElement(IXsdPart part)
        {
            if((part as Parts.Attribute) != null)
            {
                return false;
            }

            Parts.Element element = part as Parts.Element;
            if(element.Elements.Count ==0 && element.Type.Contains("string"))
            {
                return true;
            }

            return false;
        }
コード例 #16
0
        public static FlowLayoutPanel RadioButtonFlow(IXsdPart part, string defaultSelected = "", ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var panel = Container(part, tooltip);
                panel.SuspendLayout();

                var container = new FlowLayoutPanel();
                container.SuspendLayout();
                container.FlowDirection = FlowDirection.LeftToRight;
                container.AutoSize = true;
                container.Font = Methods.BaseFont;
                container.Name = "container" + part.Name;
                container.Size = new System.Drawing.Size(208, 53);

                //true false
                string selected = !String.IsNullOrWhiteSpace(part.Value) ? part.Value : defaultSelected;

                container.Controls.Add(Controls.RadioButton(part, "True", selected, tooltip));
                container.Controls.Add(Controls.RadioButton(part, "False", selected, tooltip));
                container.ResumeLayout();
                panel.Controls.Add(container);
                panel.ResumeLayout();
                return panel;
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return null;
            }
        }
コード例 #17
0
        /// <summary>
        /// Method that returns checks the SpecialLengthNames list to see which parts should be set to a specific length.
        /// </summary>
        /// <param name="part">The Attribute or Element.</param>
        /// <returns>Whether or not to use the static length.</returns>
        public static bool SpecialLength(IXsdPart child, IXsdPart parent)
        {
            if (child.SpecialLength)
            {
                return true;
            }

            string validName = "";
            if (parent != null)
            {
                validName = parent.Name + "." + child.Name;
            }
            else
            {
                validName = child.Name;
            }

            if (SpecialLengthNames.Contains(validName))
            {
                return true;
            }

            return false;
        }
コード例 #18
0
        public static Button MenuButton(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var button = new Button();
                button.SuspendLayout();
                //button.AutoSize = true;
                button.BackColor = System.Drawing.Color.FromArgb(234, 234, 234);
                button.FlatAppearance.BorderSize = 0;
                button.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
                button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
                button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                button.Font = Methods.BaseFont;
                button.UseVisualStyleBackColor = false;
                button.Size = new System.Drawing.Size(152, 23);
                button.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
                button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                button.Name = "b" + part.Name;
                button.Text = part.Name;
                button.Tag = part;

                if (tooltip != null)
                {
                    tooltip.SetToolTip(button, part.Documentation);
                }

                button.Click += new System.EventHandler(Methods.MenuButton_Click);
                button.MouseEnter += new System.EventHandler(Methods.MenuButton_MouseEnter);
                button.MouseLeave += new System.EventHandler(Methods.MenuButton_MouseLeave);

                button.ResumeLayout();
                return button;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
コード例 #19
0
        public static TextBox TextBox(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var textBox = new TextBox();
                textBox.SuspendLayout();
                textBox.BackColor = System.Drawing.Color.White;
                textBox.ForeColor = System.Drawing.Color.Black;
                textBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                textBox.Font = Methods.BaseFont;
                textBox.Name = "t" + part.Name;

                if (String.IsNullOrWhiteSpace(part.Value) && !Methods.StandAloneElement(part))
                {
                    textBox.Text = (part as Parts.Attribute).Default;
                }
                else
                {
                    textBox.Text = part.Value;
                }

                //Some textboxes will be empty but need to contain long strings.
                if (part.SpecialLength)
                {
                    textBox.Size = new System.Drawing.Size(200, 21);
                }
                else
                {
                    textBox.Size = new System.Drawing.Size(Methods.Width(textBox.Text), 21);
                }

                if (tooltip != null)
                {
                    tooltip.SetToolTip(textBox, part.Documentation);
                }

                textBox.Tag = part;

                textBox.ResumeLayout();
                return textBox;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
コード例 #20
0
        public static RadioButton RadioButton(IXsdPart part, string text, string selected, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name) || String.IsNullOrWhiteSpace(text))
                {
                    throw new ArgumentNullException();
                }
                var radioButton = new RadioButton();
                radioButton.SuspendLayout();
                radioButton.ForeColor = System.Drawing.Color.Black;
                radioButton.AutoSize = true;
                radioButton.Font = Methods.BaseFont;
                radioButton.UseVisualStyleBackColor = true;
                radioButton.Size = new System.Drawing.Size(98, 17);
                radioButton.TabStop = true;
                radioButton.Text = text;
                radioButton.Name = "rb" + part.Name + text;
                radioButton.Tag = part;

                if (selected == text.ToLower())
                {
                    radioButton.Checked = true;
                }

                if (tooltip != null)
                {
                    tooltip.SetToolTip(radioButton, part.Documentation);
                }

                radioButton.ResumeLayout();
                return radioButton;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
コード例 #21
0
        public static TextBox Numeric(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var numeric = new TextBox();
                numeric.SuspendLayout();
                numeric.ForeColor = System.Drawing.Color.Black;
                numeric.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                numeric.Font = Methods.BaseFont;
                numeric.Size = new System.Drawing.Size(60, 21);
                //numeric.Minimum = 0;
                //numeric.Maximum = 65000;
                numeric.Name = "n" + part.Name;
                numeric.Text = String.IsNullOrWhiteSpace(part.Value) ? "" : part.Value;
                numeric.Tag = part;
                numeric.KeyPress += new System.Windows.Forms.KeyPressEventHandler(SpecialCaseHandlers.NumericNumberFilter);
                numeric.ResumeLayout();

                if (tooltip != null)
                {
                    tooltip.SetToolTip(numeric, part.Documentation);
                }

                return numeric;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
コード例 #22
0
 /// <summary>
 /// Method that uses the IsAdvancedNames list to determine if something should be hidden.
 /// </summary>
 /// <param name="part">The Attribute or Element.</param>
 /// <returns>Returns true to hide something and false to show.</returns>
 public static bool IsAdvanced(IXsdPart child, IXsdPart parent)
 {
     var parentName = parent != null ? parent.Name : "";
     var name = child.Name + "." + parentName;
     if (IsAdvancedNames.Contains(name) || child.Documentation.ToLower().Contains("deprecated"))
     {
         return true;
     }
     return false;
 }