private void LoadThingsPoBarcode(TblAssetsViewModel asset) { DisplayBarcodeUsercontrol = new ObservableCollection <DisplayingBarcodeToPrintUserControl>(); var assetLayout = LayoutSettings.SingleOrDefault(x => x.printingPropertiesIserial == 13); DisplayBarcodeUsercontrol.Add(new DisplayingBarcodeToPrintUserControl(asset.Code, assetLayout, 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); } }
public SearchAssetViewModel() { if (!DesignerProperties.IsInDesignTool) { Client = new CRUD_ManagerServiceClient(); MainRowList = new SortableCollectionView <TblAssetsViewModel>(); SelectedMainRow = new TblAssetsViewModel(); Client.GetTblAssetsCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblAssetsViewModel(); if (row.TblAssetsType1 != null) { newrow.AssetTypePerRow.InjectFrom(row.TblAssetsType1); } if (row.TblHardDisk1 != null) { newrow.HardDiskPerRow.InjectFrom(row.TblHardDisk1); } if (row.TblMemory1 != null) { newrow.MemoryPerRow.InjectFrom(row.TblMemory1); } if (row.TblProcessor1 != null) { newrow.ProcessorPerRow.InjectFrom(row.TblProcessor1); } newrow.Pending = sv.PendingAssets.Any(x => x == row.Iserial); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; }; GetMaindata(); } }
public BarcodePrintPreview(TblAssetsViewModel asset, 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(asset); DialogResult = true; Application.Current.RootVisual.SetValue(IsEnabledProperty, true); }; } }