public FixedDocument Build() { properties = ObjectExtentions.ToDictionary(priceTagSettings); Func <TagPrintable, FrameworkElement> map = Normal; var borderThickness = 0.5d; if (priceTagSettings.Type == PriceTagType.Small) { map = Small; } else if (priceTagSettings.Type == PriceTagType.BigCost) { map = Big; } else if (priceTagSettings.Type == PriceTagType.BigCost2) { map = Big2; } else if (priceTagSettings.Type == PriceTagType.Custom) { map = x => priceTag.ToElement(x, priceTagSettings.Address); borderThickness = priceTag.BorderThickness; } return(FixedDocumentHelper.BuildFixedDoc(lines, l => Border(map(l), borderThickness), borderThickness, priceTagSettings.Address)); }
public FixedDocument Build() { properties = ObjectExtentions.ToDictionary(settings.RackingMap); Func <TagPrintable, FrameworkElement> map = Map; var borderThickness = 2.5d; if (settings.RackingMap.Size == RackingMapSize.Normal2) { map = Map2; borderThickness = 1d; } else if (settings.RackingMap.Size == RackingMapSize.Big) { bigHeight = new GridLength(63); defaultHeight = new GridLength(21); labelColumnWidth = new GridLength(143); valueColumnWidth = new GridLength(147); } else if (settings.RackingMap.Size == RackingMapSize.Normal) { bigHeight = new GridLength(45); defaultHeight = new GridLength(15); labelColumnWidth = new GridLength(101); valueColumnWidth = new GridLength(117); styles.Add("Номер сертификата", new Style(typeof(TextBlock)) { Setters = { new Setter(TextBlock.FontSizeProperty, 7d) } }); } else if (settings.RackingMap.Size == RackingMapSize.Custom) { borderThickness = priceTag.BorderThickness; map = x => Border(priceTag.ToElement(x), borderThickness); } return(FixedDocumentHelper.BuildFixedDoc(lines, map, borderThickness)); }
public static object InvokeDataContext(object sender, ExecutedRoutedEventArgs args) { var name = args.Parameter as string; var parameters = new object[] { args }; if (String.IsNullOrEmpty(name)) { name = ((RoutedCommand)args.Command).Name; } if (String.IsNullOrEmpty(name) && args.Parameter != null) { var values = ObjectExtentions.ToDictionary(args.Parameter); name = values.GetValueOrDefault("Method") as string; parameters = values.Where(k => k.Key != "Method").Select(k => k.Value).ToArray(); } if (String.IsNullOrEmpty(name)) { return(null); } return(InvokeDataContext(sender, name, parameters)); }