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); }
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); }
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; }
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"); }
protected bool Equals(FontFamilyWithName other) { return Equals(FontFamily, other.FontFamily); }
public MaterialFieldModel(string fieldName, string value, FontFamilyWithName fontFamilyWithName) { FieldName = fieldName; this.value = value; FontFamilyWithName = fontFamilyWithName; }