Пример #1
0
        /// <summary>
        /// Discards changes since the last <see cref="IEditableObject.BeginEdit()"/> call.
        /// </summary>
        void IEditableObject.CancelEdit()
        {
            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;
            }

            if (_backup == null)
            {
                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);
        }
 protected override void OnCancelEditCompleted(CancelEditCompletedEventArgs e)
 {
     OnCancelEditCompletedCalled = true;
 }
Пример #3
0
 /// <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)
 {
 }