protected override void OpenLine(ReportLineViewModel sltdLine) { var windowManager = base.GetService <IWindowManager>(); Predicate <ViewModelBase> predicate = (ViewModelBase wsvm) => { if (!(wsvm is OfflineSaleViewModel)) { return(false); } OfflineSaleViewModel vm = (OfflineSaleViewModel)wsvm; return(vm.SaleId == sltdLine.LineId); }; if (windowManager.Exists(predicate)) { windowManager.Activate(predicate); } else { OfflineSaleViewModel vm = new OfflineSaleViewModel(appvm, sltdLine.LineId, OnRemove, null); windowManager.ShowChildWindow(vm, this); } }
void Expand(SalePreViewModel saleToShow) { var windowManager = base.GetService <IWindowManager>(); Predicate <ViewModelBase> predicate = (ViewModelBase wsvm) => { if (!(wsvm is OfflineSaleViewModel)) { return(false); } OfflineSaleViewModel svm = (OfflineSaleViewModel)wsvm; return(svm.SaleId == saleToShow.SaleId); }; if (windowManager.Exists(predicate)) { windowManager.Activate(predicate); } else { OfflineSaleViewModel sovm = new OfflineSaleViewModel(appvm, saleToShow.SaleId, OnRemoved, OnModified); windowManager.ShowChildWindow(sovm, appvm); } }
void DoNewSale() { OfflineSaleViewModel saleVM = new OfflineSaleViewModel(appvm, OnCreated, DateTime.Now, DateTime.Today); var windowManager = base.GetService <IWindowManager>(); windowManager.ShowChildWindow(saleVM, appvm); //var windowManager = base.GetService<IWindowManager>(); //NewSaleDialogViewModel newSaleDialog = new NewSaleDialogViewModel(appvm); //if (windowManager.ShowDialog(newSaleDialog, appvm) == true) //{ // CreateNewVale(newSaleDialog.SelectedTable, newSaleDialog.SelectedWaiter, newSaleDialog.NumberOfPersons); //} }
void loadReportWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { pdvm.IsBusy = false; var windowManager = base.GetService <IWindowManager>(); windowManager.Close(pdvm); if (e.Error != null) { var msgBox = base.GetService <IMessageBoxService>(); msgBox.ShowMessage(e.Error.Message); } else { //foreach (var item in productsCreated) //{ // //appvm.ProductsOC.Add(item); // //appvm.GlobalEventsManager.FireProductCreated(item); //} int saleResultId = (int)e.Result; using (var unitOfWork = base.GetNewUnitOfWork()) { SalePreViewModel pvm = new SalePreViewModel(unitOfWork.OrderRepository.GetById(saleResultId)); visibleSales.Add(pvm); } OfflineSaleViewModel vm = new OfflineSaleViewModel(appvm, saleResultId, OnRemoved, OnModified); windowManager.ShowChildWindow(vm, appvm); } loadReportWorker.DoWork -= loadReportWorker_DoWork; loadReportWorker.ProgressChanged -= loadReportWorker_ProgressChanged; loadReportWorker.RunWorkerCompleted -= loadReportWorker_RunWorkerCompleted; loadReportWorker = null; }