private void ShellViewModelClosing(object sender, CancelEventArgs e) { if (entityController.HasChanges()) { if (entityController.CanSave()) { bool?result = messageService.ShowQuestion(shellService.ShellView, Resources.SaveChangesQuestion); if (result == true) { if (!entityController.Save()) { e.Cancel = true; } } else if (result == null) { e.Cancel = true; } } else { e.Cancel = !messageService.ShowYesNoQuestion(shellService.ShellView, Resources.LoseChangesQuestion); } } }
private void ShellViewModel_OnClosing(object sender, CancelEventArgs e) { if (_entityController.HasChanges) { if (_entityController.CanSave()) { var result = _messageService.ShowQuestion(_viewService.ShellView, Messages.SaveChangesQuestion); if (result == true) { if (!_entityController.Save()) { e.Cancel = true; } } else if (result == null) { e.Cancel = true; } } else { e.Cancel = !_messageService.ShowYesNoQuestion(_viewService.ShellView, Messages.LoseChangesQuestion); } } }