Beispiel #1
0
 private void EditCarDialogClosingEventHandler(object sender, DialogClosingEventArgs e)
 {
     if ((e.Parameter as bool?) == true)
     {
         CarsControlViewModel vm    = this.DataContext as CarsControlViewModel;
         CarViewModel         carVM = e.Content as CarViewModel;
         if (carVM.Edit)
         {
             vm.UpdateCar(carVM);
         }
         else
         {
             vm.AddCar(carVM);
         }
     }
 }
Beispiel #2
0
        private void AddCar_Click(object sender, RoutedEventArgs e)
        {
            CarViewModel vm = new CarViewModel();

            DialogHost.Show(vm, "CarsDialogHost", EditCarDialogClosingEventHandler);
        }