protected DbEditController(DbEditView view, DbEditModel model) { this.view = view; this.model = model; this.view.Source = this.model.GetAllTables(); view.Closing += this.View_Closing; view.AddItemAttempt += this.View_AddItemAttempt; view.TableSelected += this.View_TableSelected; }
private void View_Closing(object sender, CancelEventArgs e) { ControllerClosedEventArgs.CloseReason closeReason; switch (DbEditView.ConfirmChanges()) { case true: closeReason = ControllerClosedEventArgs.CloseReason.Success; model.Save(); break; case false: closeReason = ControllerClosedEventArgs.CloseReason.Abort; break; case null: e.Cancel = true; return; } ControllerClosed.Invoke(this, new ControllerClosedEventArgs(closeReason)); }