public void Execute(object parameter) { if (parameter is ClickerDeliveryDocuments.Models.DeliveryItemModel deliveryItem) { // Fix the current value of Qty to check. model.Qty = deliveryItem.Qty; ConfirmationWindow confirmationWindow = new ConfirmationWindow() { DataContext = model, Owner = Application.Current.MainWindow }; try { // Opens a new confirmtion window and returns only when the newly opened window is closed. if (confirmationWindow.ShowDialog() == true) { deliveryItem.Qty = model.Qty; model.SelectedItem = deliveryItem; ProcessingChoiceWindow processingWindow = new ProcessingChoiceWindow() { Owner = Application.Current.MainWindow }; ((ProcessingChoiceViewModel)processingWindow.DataContext) .SetUnprocessedItems(new ObservableCollection <DeliveryItemModel>() { deliveryItem }); processingWindow.Show(); } } catch (InvalidOperationException ex) { DataUtil.ShowErrorMessage(ex.Message); } catch (Exception ex) { DataUtil.ShowErrorMessage($"{ex.Message} " + $"\nMake sure that all confirmation windows closed or close app and try again."); } } }
public void Execute(object parameter) { if (model.DeliveryDataItems.Count > 0) { model.Qty = "0"; ConfirmationWindow confirmationWindow = new ConfirmationWindow() { DataContext = model, Owner = Application.Current.MainWindow }; // Hide the Quantity text box. confirmationWindow.QtyTextBox.IsEnabled = false; try { // Opens a new confirmtion window and returns only when the newly opened window is closed. if (confirmationWindow.ShowDialog() == true) { ProcessingChoiceWindow processingWindow = new ProcessingChoiceWindow() { Owner = Application.Current.MainWindow }; ((ProcessingChoiceViewModel)processingWindow.DataContext) .SetUnprocessedItems(model.DeliveryDataItems); processingWindow.Show(); } } catch (InvalidOperationException ex) { DataUtil.ShowErrorMessage(ex.Message); } catch (Exception ex) { DataUtil.ShowErrorMessage($"{ex.Message} " + $"\nMake sure that all confirmation windows closed or close app and try again."); } } }