Example #1
0
        public static MaterialModel ToMaterialModel(this Material material, IFontService fontService)
        {
            var defaultFontFamily = new FontFamilyWithName(fontService.GetFontFamily(material.DefaultFont));

            return new MaterialModel(material.Id, material.Title, material.Description,
                material.MaterialFields.Select(f => f.ToMaterialFieldModel(fontService)), material.FlyerFrontSide,
                material.FlyerBackside, defaultFontFamily);
        }
Example #2
0
        public static MaterialFieldModel ToMaterialFieldModel(this MaterialField field, IFontService fontService)
        {
            var fontFamilyWithName = new FontFamilyWithName(fontService.GetFontFamily(field.FontName));

            return new MaterialFieldModel(field.FieldName, field.Value, fontFamilyWithName, field.FontSize, field.Bold,
                field.Italic, field.Uppper, field.MaxLength, field.MaxRows, field.LeftMargin, field.TopMargin,
                field.TextColor);
        }
Example #3
0
 public MaterialFieldModel(string fieldName, string value, FontFamilyWithName fontFamilyWithName, int fontSize,
     bool bold, bool italic, bool uppper, int maxLength, int maxRows, int leftMargin, int topMargin,
     string textColor = "Black")
     : this(fieldName, value, fontFamilyWithName)
 {
     TextColor = textColor;
     FontSize = fontSize;
     Bold = bold;
     Italic = italic;
     Uppper = uppper;
     MaxLength = maxLength;
     MaxRows = maxRows;
     LeftMargin = leftMargin;
     TopMargin = topMargin;
 }
Example #4
0
        public MaterialModel(int id, string title, string description, IEnumerable<MaterialFieldModel> materialFields,
            byte[] flyerFrontSide, byte[] flyerBackside, FontFamilyWithName defaultFont)
        {
            MaterialFields = new ObservableCollection<MaterialFieldModel>();

            Id = id;
            Title = title;
            Description = description;

            materialFields.ToList().ForEach(AddMaterialField);

            MaterialFields.CollectionChanged += (s, e) => OnPropertyChanged("MaterialFields");

            FlyerFrontSide = flyerFrontSide;
            FlyerBackside = flyerBackside;
            DefaultFont = defaultFont;

            LogoModel = new LogoModel();
            LogoModel.PropertyChanged += (s, e) => OnPropertyChanged("Logo");
        }
Example #5
0
 protected bool Equals(FontFamilyWithName other)
 {
     return Equals(FontFamily, other.FontFamily);
 }
Example #6
0
 public MaterialFieldModel(string fieldName, string value, FontFamilyWithName fontFamilyWithName)
 {
     FieldName = fieldName;
     this.value = value;
     FontFamilyWithName = fontFamilyWithName;
 }