private void InitializeControls() { ComboBoxItem selectedItem = jobOrderType.SelectedItem as ComboBoxItem; if (selectedItem != null && selectedItem.Content != null) { if (selectedItem.Content.ToString() == "Dyeing") { CreateNewDyeingJo(); dyeingJOControl.Visibility = System.Windows.Visibility.Visible; knittingJOControl.Visibility = System.Windows.Visibility.Hidden; compactingJoControl.Visibility = Visibility.Hidden; actionButtonsContainer.Visibility = System.Windows.Visibility.Visible; selectedJobOrderControl = dyeingJOControl; } else if (selectedItem.Content.ToString() == "Knitting") { CreateNewKnittingJo(); dyeingJOControl.Visibility = System.Windows.Visibility.Hidden; knittingJOControl.Visibility = System.Windows.Visibility.Visible; compactingJoControl.Visibility = Visibility.Hidden; actionButtonsContainer.Visibility = System.Windows.Visibility.Visible; selectedJobOrderControl = knittingJOControl; } else if (selectedItem.Content.ToString() == "Compacting") { CreateNewCompactingJo(); dyeingJOControl.Visibility = System.Windows.Visibility.Hidden; knittingJOControl.Visibility = System.Windows.Visibility.Hidden; compactingJoControl.Visibility = Visibility.Visible; actionButtonsContainer.Visibility = System.Windows.Visibility.Visible; selectedJobOrderControl = compactingJoControl; } else { dyeingJOControl.Visibility = System.Windows.Visibility.Hidden; knittingJOControl.Visibility = System.Windows.Visibility.Hidden; selectedJobOrderControl = null; } } if (ViewModel != null) { ViewModel.RefreshUIButtons(); } }
private void positiveBtn_Click_1(object sender, RoutedEventArgs e) { string buttonContent = positiveBtn.Content.ToString(); switch (buttonContent) { case "Generate": if (selectedJobOrderControl.Generate()) { if (selectedJobOrderControl is DyeingJOControl) { ((DyeingJOControl)selectedJobOrderControl).ViewModel = null; } else if (selectedJobOrderControl is KnittingJoControl) { ((KnittingJoControl)selectedJobOrderControl).ViewModel = null; } else if (selectedJobOrderControl is CompactingJoControl) { ((CompactingJoControl) selectedJobOrderControl).ViewModel = null; } actionButtonsContainer.Visibility = System.Windows.Visibility.Collapsed; selectedJobOrderControl = null; OnCloseDialog(true); } break; case "Submit": selectedJobOrderControl.Submit(); break; case "Approve": selectedJobOrderControl.Approve(); break; case "PDF": selectedJobOrderControl.ShowPDF(); break; } ViewModel.RefreshUIButtons(); }
public void OpenExistingJo(object jo) { if (jo is DyeingJO) { dyeingJOControl.OpenExistingJo(jo as DyeingJO); dyeingJOControl.Visibility = System.Windows.Visibility.Visible; knittingJOControl.Visibility = System.Windows.Visibility.Hidden; compactingJoControl.Visibility = Visibility.Hidden; actionButtonsContainer.Visibility = System.Windows.Visibility.Visible; selectedJobOrderControl = dyeingJOControl; ViewModel.CurrentViewActionButtons = dyeingJOControl.ViewModel as IActionButtons; } else if (jo is KnittingJO) { knittingJOControl.OpenExistingJo(jo as KnittingJO); dyeingJOControl.Visibility = System.Windows.Visibility.Hidden; knittingJOControl.Visibility = System.Windows.Visibility.Visible; compactingJoControl.Visibility = Visibility.Hidden; actionButtonsContainer.Visibility = System.Windows.Visibility.Visible; selectedJobOrderControl = knittingJOControl; ViewModel.CurrentViewActionButtons = knittingJOControl.ViewModel as IActionButtons; } else if (jo is CompactingJo) { compactingJoControl.OpenExistingJo(jo as CompactingJo); dyeingJOControl.Visibility = System.Windows.Visibility.Hidden; knittingJOControl.Visibility = System.Windows.Visibility.Hidden; compactingJoControl.Visibility = Visibility.Visible; actionButtonsContainer.Visibility = System.Windows.Visibility.Visible; selectedJobOrderControl = compactingJoControl; ViewModel.CurrentViewActionButtons = compactingJoControl.ViewModel as IActionButtons; } joTypeSelection.Visibility = System.Windows.Visibility.Collapsed; ViewModel.RefreshUIButtons(); }