TrayBarcodeView.xaml.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using TrayBarcodeManagement.Model;
  4. using TrayBarcodeManagement.ViewModel;
  5. namespace TrayBarcodeManagement.View
  6. {
  7. /// <summary>
  8. /// TrayBarcodeView.xaml 的交互逻辑
  9. /// </summary>
  10. public partial class TrayBarcodeView : UserControl
  11. {
  12. public TrayBarcodeView()
  13. {
  14. InitializeComponent();
  15. }
  16. private void ExitButton_Click(object sender, RoutedEventArgs e)
  17. {
  18. Application.Current.Shutdown();
  19. }
  20. private void MaxButton_Click(object sender, RoutedEventArgs e)
  21. {
  22. if (Application.Current.MainWindow.WindowState == WindowState.Normal)
  23. {
  24. Application.Current.MainWindow.WindowState = WindowState.Maximized;
  25. }
  26. else
  27. {
  28. Application.Current.MainWindow.WindowState = WindowState.Normal;
  29. }
  30. }
  31. private void MinButton_Click(object sender, RoutedEventArgs e)
  32. {
  33. Application.Current.MainWindow.WindowState = WindowState.Minimized;
  34. }
  35. private void AddButton_Click(object sender, RoutedEventArgs e)
  36. {
  37. DetailTrayBarcodeView detailTrayBarcodeView = new DetailTrayBarcodeView();
  38. detailTrayBarcodeView.DataContext = new DetailTrayBarcodeViewModel(new TrayBarcodeModel(), false);
  39. detailTrayBarcodeView.Show();
  40. }
  41. private void DataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
  42. {
  43. TrayBarcodeViewModel trayBarcodeViewModel = this.DataContext as TrayBarcodeViewModel;
  44. DetailTrayBarcodeView detailTrayBarcodeView = new DetailTrayBarcodeView();
  45. detailTrayBarcodeView.DataContext = new DetailTrayBarcodeViewModel(trayBarcodeViewModel.TrayBarcodeModel, true);
  46. detailTrayBarcodeView.Show();
  47. }
  48. }
  49. }