Ejemplo n.º 1
0
 void EditExecute()
 {
     EditStudentWindow window = new EditStudentWindow();
     Student editItem = new Student();
     editItem.CloneFrom(this.SelectedItem);
     EditStudentWindowViewModel vm = new EditStudentWindowViewModel(editItem, window);
     window.DataContext = vm;
     window.ShowDialog();
     OnEditComplete(vm);
 }
Ejemplo n.º 2
0
 void OnEditComplete(EditStudentWindowViewModel vm)
 {
     if (vm.IsSaveClicked)
     {
         if (!vm.IsForNew)
         {
             this.SelectedItem.CloneFrom(vm.CurrentStudent);
             ((MainWindow)this.CurrentWindow).ResizeGridViewColumns();
         }
         else
         {
             Student stu = vm.CurrentStudent;
             this._allStudents.Add(stu);
             DBHandler.Instance.Insert(stu);
             this.Students = this._allStudents;
             ((MainWindow)this.CurrentWindow).ResizeGridViewColumns();
         }
     }
 }
Ejemplo n.º 3
0
 void AddExecute()
 {
     EditStudentWindow window = new EditStudentWindow();
     EditStudentWindowViewModel vm = new EditStudentWindowViewModel(null, window);
     window.DataContext = vm;
     window.ShowDialog();
     OnEditComplete(vm);
 }