Esempio n. 1
0
 public BitControl(BitAttribute attribute)
 {
     InitializeComponent();
     Label.Content = attribute.Label;
     this.SetValue(Grid.RowProperty, attribute.Row);
     this.SetValue(Grid.ColumnProperty, attribute.Column);
     this.SetValue(Grid.ColumnSpanProperty, attribute.ColumnSpan);
     _attribute = attribute;
     if (attribute.Value == "True")
     {
         CheckBox.IsChecked = true;
     }
 }
Esempio n. 2
0
        public static Attribute Create(string type, string properties, Dictionary <string, Attribute> attributes = null, DocInputs inputs = null)
        {
            var propertiesMap = properties.Split('|')
                                .ToDictionary(x => x.Split(':')[0], x => x.Split(':').Length > 1 ? x.Split(':')[1] : string.Empty);
            Attribute attribute;

            switch (type)
            {
            case "Text":
            case "TextArea":
                attribute = new TextAttribute(type);
                break;

            case "Enum":
                attribute = new EnumAttribute(type);
                break;

            case "Bit":
                attribute = new BitAttribute(type);
                break;

            case "Label":
                attribute = new LabelAttribute(type);
                break;

            case "Image":
                attribute = new ImageAttribute(type);
                break;

            case "File":
                attribute = new FileAttribute(type);
                break;

            case "Complex":
                var attr = new ComplexAttribute(type);
                attr.SetProperties(propertiesMap, attributes);
                attribute = attr;
                break;

            case "Unique":
                attribute = new UniqueAttribute(type, inputs);
                break;

            default:
                attribute = new Attribute("");
                break;
            }
            attribute.SetProperties(propertiesMap);
            return(attribute);
        }