public MainWindow()
 {
     InitializeComponent();
     MainWindowViewModel viewModel = new MainWindowViewModel();
     this.DataContext = viewModel;
     Closing += viewModel.OnWindowClosing;
 }
 public PrintBarcodeCommand(MainWindowViewModel viewModel)
 {
     this.viewModel = viewModel;
     this.viewModel.PropertyChanged += (s, e) =>
     {
         if (this.CanExecuteChanged != null)
         {
             this.CanExecuteChanged(this, new EventArgs());
         }
     };
 }