コード例 #1
0
 public BarcodePrintPreview(bankchequePrint_Result bankCheque, int operation, string printingCode, bool Print)
 {
     InitializeComponent();
     PrintingFlag   = Print;
     PrintingList   = new ObservableCollection <PrintingFabricDefectslist>();
     LayoutSettings = new ObservableCollection <BarcodeLayoutSettings>();
     if (Print)
     {
         webService.BarCodePrintLayoutOperationAsync(operation, printingCode);
         webService.BarCodePrintLayoutOperationCompleted += (s, sv) =>
         {
             foreach (var item in sv.Result)
             {
                 LayoutSettings.Add(MapToLayoutSettings(item));
             }
             DataContext = LayoutSettings.OrderByDescending(x => x.PageHeightProperty).FirstOrDefault();
             LoadThingsPoBarcode(bankCheque);
             DialogResult = true;
             Application.Current.RootVisual.SetValue(IsEnabledProperty, true);
         };
     }
 }
コード例 #2
0
        private void LoadThingsPoBarcode(bankchequePrint_Result bankcheque)
        {
            DisplayBarcodeUsercontrol = new ObservableCollection <DisplayingBarcodeToPrintUserControl>();

            var dateLayout         = LayoutSettings.SingleOrDefault(x => x.printingPropertiesIserial == 14);
            var payToLayout        = LayoutSettings.SingleOrDefault(x => x.printingPropertiesIserial == 15);
            var amountLayout       = LayoutSettings.SingleOrDefault(x => x.printingPropertiesIserial == 16);
            var amountStringLayout = LayoutSettings.SingleOrDefault(x => x.printingPropertiesIserial == 18);


            DisplayBarcodeUsercontrol.Add(new DisplayingBarcodeToPrintUserControl(bankcheque.Date.ToString(), dateLayout, LayoutSettings, null));
            DisplayBarcodeUsercontrol.Add(new DisplayingBarcodeToPrintUserControl(bankcheque.PayTo, payToLayout, LayoutSettings, null));
            DisplayBarcodeUsercontrol.Add(new DisplayingBarcodeToPrintUserControl(bankcheque.Amount.ToString(CultureInfo.InvariantCulture), amountLayout, LayoutSettings, null));
            DisplayBarcodeUsercontrol.Add(new DisplayingBarcodeToPrintUserControl(bankcheque.AmountString.ToString(CultureInfo.InvariantCulture), amountStringLayout, LayoutSettings, null));


            var newcan = new Canvas();

            foreach (var barcodes in DisplayBarcodeUsercontrol)
            {
                if (PrintingFlag)
                {
                    newcan.Children.Add(barcodes);
                }
                if (!PrintingFlag)
                {
                    CanvasPreview.Children.Add(barcodes);
                }
            }

            if (PrintingFlag)
            {
                print(newcan);
                //     CanvasList.Add(Newcan);
            }
        }