Esempio n. 1
0
        protected override void Render(HtmlTextWriter writer)
        {
            List <string> keysToRemove = new List <string>();

            foreach (object key in Attributes.Keys)
            {
                string keyString = (string)key;
                InputAttributes.Add(keyString, Attributes[keyString]);
                keysToRemove.Add(keyString);
            }
            foreach (string key in keysToRemove)
            {
                Attributes.Remove(key);
            }
            base.Render(writer);
        }
        private void BuildComponent()
        {
            ConfigureComponent();
            if (InputAttributes != null && InputAttributes.ContainsKey("Class"))
            {
                ElementClass = $"{ElementClass} {InputAttributes["Class"]}";
                InputAttributes.Remove("Class");
            }

            if (AsComponent != null && !ElementAttributes.ContainsKey(nameof(ChildContent)))
            {
                ElementAttributes.Add(nameof(ChildContent), ChildContent);
            }

            ElementAttributes["Class"] = ElementClass;
        }
Esempio n. 3
0
        public List <InputAttributes> GetAllVisionInputsAttributes()
        {
            List <InputAttributes> attributesList = new List <InputAttributes>();

            foreach (Tuple <int, Window, Input, OnScreenDisplay> data in GetAllVisionInputs())
            {
                InputAttributes inputAttr = new InputAttributes()
                {
                    InputId     = data.Item1,
                    DisplayName = data.Item3.LabelName,
                };

                attributesList.Add(inputAttr);
            }

            return(attributesList);
        }
Esempio n. 4
0
        protected void data_separator(string line)
        {
            Requires(line != null);

            string[] temp_lines = line.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (temp_lines.Count() > 0)
            {
                string[] input_InputAttributestring = new string[InputAttributes.Count()];
                double[] input_InputAttributevalue  = new double[InputAttributes.Count()];
                for (int i = 0; i < InputAttributes.Count(); i++)
                {
                    if (InputAttributes[i].LabelsValues.Count == 0)
                    {
                        double temp;
                        string comma = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
                        double.TryParse(temp_lines[i].Replace(".", comma), out temp);
                        input_InputAttributevalue[i]  = temp;
                        input_InputAttributestring[i] = "";
                    }
                    else
                    {
                        input_InputAttributestring[i] = temp_lines[i];
                        input_InputAttributevalue[i]  = double.NaN;
                    }
                }
                string class_label = temp_lines[temp_lines.Count() - 1].ToLowerInvariant();
                double temp_out    = double.NaN;
                if (OutputAttribute.LabelsValues.Count == 0)
                {
                    string comma = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

                    double.TryParse(class_label.Replace(".", comma), out temp_out);
                    class_label = "";
                }
                RowSample temp_Row_sample = new RowSample(input_InputAttributevalue, input_InputAttributestring, temp_out, class_label);

                DataRows.Add(temp_Row_sample);
            }
        }
Esempio n. 5
0
 public extern static Element input(InputAttributes properties, params Element[] children);
Esempio n. 6
0
        internal virtual void RenderInputTag(HtmlTextWriter writer, string clientID, string onClick)
        {
            if (clientID != null)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, clientID);
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox");

            if (UniqueID != null)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
            }

            // Whidbey 20815
            if (_valueAttribute != null)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Value, _valueAttribute);
            }

            if (Checked)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Checked, "checked");
            }

            // ASURT 119141: Render ---- attribute on the INPUT tag (instead of the SPAN) so the checkbox actually gets disabled when Enabled=false
            if (!IsEnabled && SupportsDisabledAttribute)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
            }

            if (AutoPostBack && (Page != null) && Page.ClientSupportsJavaScript)
            {
                PostBackOptions options = new PostBackOptions(this, String.Empty);

                if (CausesValidation && Page.GetValidators(ValidationGroup).Count > 0)
                {
                    options.PerformValidation = true;
                    options.ValidationGroup   = ValidationGroup;
                }

                if (Page.Form != null)
                {
                    options.AutoPostBack = true;
                }

                // ASURT 98368
                // Need to merge the autopostback script with the user script
                onClick = Util.MergeScript(onClick, Page.ClientScript.GetPostBackEventReference(options, true));
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick);

                if (EnableLegacyRendering)
                {
                    writer.AddAttribute("language", "javascript", false);
                }
            }
            else
            {
                if (Page != null)
                {
                    Page.ClientScript.RegisterForEventValidation(this.UniqueID);
                }

                if (onClick != null)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick);
                }
            }

            string s = AccessKey;

            if (s.Length > 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, s);
            }

            int i = TabIndex;

            if (i != 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, i.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (BinaryCompatibility.Current.TargetsAtLeastFramework48 && _inputAttributesState != null && _inputAttributesState.Count != 0)
            {
                InputAttributes.AddAttributes(writer);
            }
            else if (_inputAttributes != null && _inputAttributes.Count != 0)
            {
                _inputAttributes.AddAttributes(writer);
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();
        }
 /// <summary>
 /// Return the Component Attributes
 /// </summary>
 /// <returns></returns>
 protected virtual IEnumerable <KeyValuePair <string, object> > GetRootElementAttributes()
 {
     return(InputAttributes.GetMainElementAttributes());
 }
Esempio n. 8
0
 public extern static ReactElement Input(InputAttributes properties, params ReactElementOrText[] children);
Esempio n. 9
0
        protected bool KEEL_separator(string Line)
        {
            if (Line[0] == '@')
            {
                string[] temp_lines = Line.Split(new char[] { ',', '@', ' ', '[', ']', '{' },
                                                 StringSplitOptions.RemoveEmptyEntries);
                if (temp_lines[0].Equals("relation", StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
                if (temp_lines[0].Equals("attribute", StringComparison.OrdinalIgnoreCase))
                {
                    AttributeInfo temp_Attrtibute = new AttributeInfo();
                    temp_Attrtibute.Name = temp_lines[1];
                    if (temp_lines[2].Equals("integer", StringComparison.OrdinalIgnoreCase))
                    {
                        temp_Attrtibute.Type = AttributeInfo.TypeAttribute.integer;
                    }
                    if (temp_lines[2].Equals("real", StringComparison.OrdinalIgnoreCase))
                    {
                        temp_Attrtibute.Type = AttributeInfo.TypeAttribute.real;
                    }
                    if (temp_lines[2].Equals("integer", StringComparison.OrdinalIgnoreCase) ||
                        temp_lines[2].Equals("real", StringComparison.OrdinalIgnoreCase))
                    {
                        double temp;
                        string comma = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

                        double.TryParse(temp_lines[3].Replace(".", comma), out temp);
                        temp_Attrtibute.Min = temp;
                        double.TryParse(temp_lines[4].Replace(".", comma), out temp);
                        temp_Attrtibute.Max = temp;
                        InputAttributes.Add(temp_Attrtibute);
                    }
                    else
                    {
                        temp_Attrtibute.Type = AttributeInfo.TypeAttribute.nominate;
                        if (temp_lines.Where(i => i.Contains('}')).Count() > 0)
                        {
                            temp_Attrtibute.Name = temp_lines[1].Split(new char[] { '{', '}' })[0];
                            for (int i = 2; i < temp_lines.Count(); i++)
                            {
                                string[] temp_set_line = temp_lines[i].Split(new char[] { '{', ',', '}' },
                                                                             StringSplitOptions.RemoveEmptyEntries);
                                temp_Attrtibute.LabelsValues.Add(temp_set_line[0].ToLowerInvariant());
                            }
                            InputAttributes.Add(temp_Attrtibute);
                        }
                    }
                    return(true);
                }
                if (temp_lines[0].Equals("inputs", StringComparison.OrdinalIgnoreCase))
                {
                    for (int i = 1; i < temp_lines.Count(); i++)
                    {
                        if (
                            InputAttributes.First(x => x.Name.Equals(temp_lines[i], StringComparison.OrdinalIgnoreCase)) ==
                            null)
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                if (temp_lines[0].Equals("outputs", StringComparison.OrdinalIgnoreCase) || temp_lines[0].Equals("output", StringComparison.OrdinalIgnoreCase))
                {
                    for (int i = 1; i < temp_lines.Count(); i++)
                    {
                        OutputAttribute =
                            InputAttributes.First(x => x.Name.Equals(temp_lines[i], StringComparison.OrdinalIgnoreCase));
                        InputAttributes.RemoveAll(x => x == OutputAttribute);
                    }
                    return(true);
                }

                if (temp_lines[0].Equals("data", StringComparison.OrdinalIgnoreCase))
                {
                    if (OutputAttribute.LabelsValues.Count() == 0)
                    {
                        Type = TypeSampleSet.Approximation;
                    }
                    else
                    {
                        Type = TypeSampleSet.Classifier;
                    }
                    return(false);
                }
            }
            if (OutputAttribute.LabelsValues.Count() == 0)
            {
                Type = TypeSampleSet.Approximation;
            }
            else
            {
                Type = TypeSampleSet.Classifier;
            }
            return(false);
        }