Exemplo n.º 1
0
        public PlywoodItem(IParent parent) : base(parent)
        {
            var builder = new CaptionBuilder(this);

            Thickness = builder.CreateComboBox(nameof(Thickness), App.Config.Plywood);
            Quantity  = builder.CreateTextBox(nameof(Quantity), int.TryParse, value: 1);

            Fields = new BindableCollection <IHasValue>
            {
                Thickness, Quantity
            };
        }
Exemplo n.º 2
0
        public GlassViewModel(IParent parent) : base(parent)
        {
            var builder = new CaptionBuilder(this);

            Amount   = builder.CreateComboBox(nameof(Amount), App.Config.Values, decimal.TryParse);
            Quantity = builder.CreateTextBox <int>(nameof(Quantity), int.TryParse);

            Fields = new List <IHasValue>
            {
                Amount, Quantity
            };
        }
Exemplo n.º 3
0
        public ConcealedViewModel(IParent parent) : base(parent)
        {
            var builder = new CaptionBuilder(this);

            Amount = builder.CreateComboBox(nameof(Amount), App.Config.Values, decimal.TryParse);
            Pairs  = builder.CreateTextBox <int>(nameof(Pairs), int.TryParse);

            Fields = new List <IHasValue>
            {
                Amount, Pairs
            };
        }
Exemplo n.º 4
0
        public PlywoodViewModel(IParent parentModel) : base(parentModel)
        {
            var builder = new CaptionBuilder(this);

            Thickness = builder.CreateComboBox(nameof(Thickness), _plywood.Thicknesses);
            Quantity  = builder.CreateTextBox(nameof(Quantity), int.TryParse, 1);

            Fields = new List <IHasValue>
            {
                Thickness, Quantity
            };
        }
Exemplo n.º 5
0
        public FrameViewModel(IParent parent) : base(parent)
        {
            var builder = new CaptionBuilder(this);

            Labor    = builder.CreateComboBox(nameof(Labor), App.Config.Values, decimal.TryParse);
            Frame    = builder.CreateComboBox(nameof(Frame), App.Config.Values, decimal.TryParse);
            Quantity = builder.CreateTextBox <int>(nameof(Quantity), int.TryParse);

            Fields = new List <IHasValue>
            {
                Labor, Frame, Quantity
            };
        }
Exemplo n.º 6
0
        public PieceItem(IParent parent, Piece material) : base(parent)
        {
            _material = material;

            var builder = new CaptionBuilder(this);

            Amount = builder.CreateComboBox(nameof(Amount), App.Config.PieceValues, decimal.TryParse, "PHP",
                                            _material.Value);
            Quantity = builder.CreateTextBox(nameof(Quantity), int.TryParse, value: 1);

            Fields = new BindableCollection <IHasValue>
            {
                Amount, Quantity
            };
        }
Exemplo n.º 7
0
        public WoodViewModel(ItemViewModel source, IMaterial material) : base(source)
        {
            _material = material;
            var builder = new CaptionBuilder(this);

            Thickness = builder.CreateTextBox(nameof(Thickness), int.TryParse, 2);
            Width     = builder.CreateComboBox(nameof(Width), App.Config.Widths);
            Length    = builder.CreateComboBox(nameof(Length), App.Config.Lengths);
            Quantity  = builder.CreateTextBox(nameof(Quantity), int.TryParse, 1);

            Fields = new List <IHasValue>
            {
                Thickness, Width, Length, Quantity
            };
        }
Exemplo n.º 8
0
        public WoodItem(ItemViewModel parent, Wood wood) : base(parent)
        {
            _wood = wood;
            var builder = new CaptionBuilder(this);

            Thickness = builder.CreateTextBox(nameof(Thickness), int.TryParse, "in", 2);
            Width = builder.CreateComboBox(nameof(Width), this.GetCuboid().Widths, label: "in");
            Length = builder.CreateComboBox(nameof(Length), this.GetCuboid().Lengths, label: "ft");
            Quantity = builder.CreateTextBox(nameof(Quantity), int.TryParse, value: 1);

            Fields = new BindableCollection<IHasValue>
            {
                Thickness, Width, Length, Quantity
            };
        }
Exemplo n.º 9
0
        public FoamItem(ItemViewModel parent) : base(parent)
        {
            var widths = App.Config.Cuboids
                         .Single(x => x.Type == Type).Widths;
            var lengths = App.Config.Cuboids
                          .Single(x => x.Type == Type).Lengths;
            var builder = new CaptionBuilder(this);

            Thickness = builder.CreateTextBox(nameof(Thickness), int.TryParse, "in", 2);
            Width     = builder.CreateComboBox(nameof(Width), this.GetCuboid().Widths, label: "in");
            Length    = builder.CreateComboBox(nameof(Length), this.GetCuboid().Lengths, label: "ft");
            Quantity  = builder.CreateTextBox(nameof(Quantity), int.TryParse, value: 1);
            Labor     = builder.CreateComboBox(nameof(Labor), App.Config.PieceValues, decimal.TryParse, "PHP", 150);
            Amount    = builder.CreateComboBox(nameof(Amount), App.Config.PieceValues, decimal.TryParse, "PHP", 150);

            Fields = new BindableCollection <IHasValue>
            {
                Labor, Thickness, Width, Length, Amount, Quantity
            };
        }
Exemplo n.º 10
0
 public void StartElement(string uri, string localName, string qName, IEnumerable <XAttribute> attributes)
 {
     try {
         if ("rendertheme".Equals(qName))
         {
             CheckState(qName, Element.RenderTheme);
             this.renderTheme = new RenderThemeBuilder(qName, attributes).build();
         }
         else if (ElementNameRule.Equals(qName))
         {
             CheckState(qName, Element.Rule);
             Rule rule = new RuleBuilder(qName, attributes, this.ruleStack).build();
             if (this.ruleStack.Count != 0)
             {
                 this.currentRule.AddSubRule(rule);
             }
             this.currentRule = rule;
             this.ruleStack.Push(this.currentRule);
         }
         else if ("area".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Area area = new AreaBuilder(qName, attributes, this.level++, this.relativePathPrefix).build();
             this.currentRule.AddRenderingInstruction(area);
         }
         else if ("caption".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Caption caption = new CaptionBuilder(qName, attributes).build();
             this.currentRule.AddRenderingInstruction(caption);
         }
         else if ("circle".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Circle circle = new CircleBuilder(qName, attributes, this.level++).build();
             this.currentRule.AddRenderingInstruction(circle);
         }
         else if ("line".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Line line = new LineBuilder(qName, attributes, this.level++, this.relativePathPrefix).build();
             this.currentRule.AddRenderingInstruction(line);
         }
         else if ("lineSymbol".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             LineSymbol lineSymbol = new LineSymbolBuilder(qName, attributes,
                                                           this.relativePathPrefix).build();
             this.currentRule.AddRenderingInstruction(lineSymbol);
         }
         else if ("pathText".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             PathText pathText = new PathTextBuilder(qName, attributes).build();
             this.currentRule.AddRenderingInstruction(pathText);
         }
         else if ("symbol".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Symbol symbol = new SymbolBuilder(qName, attributes, this.relativePathPrefix).build();
             this.currentRule.AddRenderingInstruction(symbol);
         }
         else
         {
             throw new XmlException("unknown element: " + qName);
         }
     } catch (IOException e) {
         throw new XmlException(null, e);
     }
 }