using System.Windows; using System.Windows.Controls; using TrayBarcodeManagement.Model; using TrayBarcodeManagement.ViewModel; namespace TrayBarcodeManagement.View { /// /// TrayBarcodeView.xaml 的交互逻辑 /// public partial class TrayBarcodeView : UserControl { public TrayBarcodeView() { InitializeComponent(); } private void ExitButton_Click(object sender, RoutedEventArgs e) { Application.Current.Shutdown(); } private void MaxButton_Click(object sender, RoutedEventArgs e) { if (Application.Current.MainWindow.WindowState == WindowState.Normal) { Application.Current.MainWindow.WindowState = WindowState.Maximized; } else { Application.Current.MainWindow.WindowState = WindowState.Normal; } } private void MinButton_Click(object sender, RoutedEventArgs e) { Application.Current.MainWindow.WindowState = WindowState.Minimized; } private void AddButton_Click(object sender, RoutedEventArgs e) { DetailTrayBarcodeView detailTrayBarcodeView = new DetailTrayBarcodeView(); detailTrayBarcodeView.DataContext = new DetailTrayBarcodeViewModel(new TrayBarcodeModel(), false); detailTrayBarcodeView.Show(); } private void DataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { TrayBarcodeViewModel trayBarcodeViewModel = this.DataContext as TrayBarcodeViewModel; DetailTrayBarcodeView detailTrayBarcodeView = new DetailTrayBarcodeView(); detailTrayBarcodeView.DataContext = new DetailTrayBarcodeViewModel(trayBarcodeViewModel.TrayBarcodeModel, true); detailTrayBarcodeView.Show(); } } }