/// <summary> /// Discards changes since the last <see cref="IEditableObject.BeginEdit()"/> call. /// </summary> void IEditableObject.CancelEdit() { if (_backup == null) { Log.Debug("IEditableObject is not in edit state"); return; } CancelEditCompletedEventArgs cancelEditCompletedEventArgs; var eventArgs = new CancelEditEventArgs(this); _cancelEditingEvent.SafeInvoke(this, eventArgs); OnCancelEdit(eventArgs); if (eventArgs.Cancel) { Log.Info("IEditableObject.CancelEdit is canceled by the event args"); cancelEditCompletedEventArgs = new CancelEditCompletedEventArgs(true); _cancelEditingCompletedEvent.SafeInvoke(this, cancelEditCompletedEventArgs); OnCancelEditCompleted(cancelEditCompletedEventArgs); return; } Log.Debug("IEditableObject.CancelEdit"); _backup.RestoreBackup(); _backup = null; cancelEditCompletedEventArgs = new CancelEditCompletedEventArgs(false); _cancelEditingCompletedEvent.SafeInvoke(this, cancelEditCompletedEventArgs); OnCancelEditCompleted(cancelEditCompletedEventArgs); }
/// <summary> /// Raises the <see cref="IAdvancedEditableObject.CancelEditingCompleted"/> event. /// </summary> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected virtual void OnCancelEditCompleted(CancelEditCompletedEventArgs e) { }
protected override void OnCancelEditCompleted(CancelEditCompletedEventArgs e) { OnCancelEditCompletedCalled = true; }