private void _treeView_OnBeforeSelect(object sender, TreeViewCancelEventArgs e) { if (_gridControl.Grid == null || _gridControl.Grid.BusinessObjectCollection == null) { return; } if (_gridControl.Grid.BusinessObjectCollection.IsDirty) { DialogResult result = _controlFactory.ShowMessageBox("Do you want to save changes?", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); switch (result) { case DialogResult.Yes: e.Cancel = !SaveChanges(); break; case DialogResult.No: e.Cancel = !RejectChanges(); break; default: e.Cancel = true; break; } } }
/// <summary> /// Displays a message box to the user to check if they want to save /// the selected business object. /// </summary> public DialogResult CheckUserWantsToSave() { return(_controlFactory.ShowMessageBox( "Would you like to save your changes?", "Save Changes?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)); }