Пример #1
0
 public void Dispose()
 {
     if (this.owner != null)
     {
         this.owner.ClearCachedHashCode();
         this.owner = null;
     }
 }
Пример #2
0
 internal ChangeScope(ReferenceValue owner)
 {
     Validate.IsNotNull <ReferenceValue>(owner, "owner");
     this.owner = owner;
 }
Пример #3
0
        private void StepBackwardImpl(IWin32Window owner)
        {
            HistoryMemento     historyMemento = this.undoStack[this.undoStack.Count - 1];
            ToolHistoryMemento memento2       = historyMemento as ToolHistoryMemento;

            if ((memento2 != null) && (memento2.ToolType != this.documentWorkspace.GetToolType()))
            {
                this.documentWorkspace.SetToolFromType(memento2.ToolType);
                this.StepBackwardImpl(owner);
            }
            else
            {
                this.OnChanging();
                ExecutingHistoryMementoEventArgs e = new ExecutingHistoryMementoEventArgs(historyMemento, true, false);
                if ((memento2 == null) && (historyMemento.SeriesGuid == Guid.Empty))
                {
                    e.SuspendTool = true;
                }
                this.OnExecutingHistoryMemento(e);
                ReferenceValue changes = null;
                System.Type    type    = null;
                if (e.SuspendTool)
                {
                    TransactedTool tool = this.documentWorkspace.Tool as TransactedTool;
                    if (tool != null)
                    {
                        type = tool.GetType();
                        tool.ForceCancelDrawingOrEditing();
                        if (tool.State == TransactedToolState.Dirty)
                        {
                            changes = tool.Changes;
                            tool.CancelChanges();
                        }
                    }
                    this.documentWorkspace.PushNullTool();
                }
                HistoryMemento memento3 = this.undoStack[this.undoStack.Count - 1];
                ExecutingHistoryMementoEventArgs args2 = new ExecutingHistoryMementoEventArgs(memento3, false, e.SuspendTool);
                this.OnExecutingHistoryMemento(args2);
                using (this.disallowPushNewMementoRegion.UseEnterScope())
                {
                    HistoryMemento item = this.undoStack[this.undoStack.Count - 1].PerformUndo(null);
                    this.undoStack.RemoveAt(this.undoStack.Count - 1);
                    this.redoStack.Insert(0, item);
                    ExecutedHistoryMementoEventArgs args3 = new ExecutedHistoryMementoEventArgs(item);
                    this.OnExecutedHistoryMemento(args3);
                    this.OnChanged();
                    this.OnSteppedBackward();
                    item.Flush();
                }
                if (e.SuspendTool)
                {
                    this.documentWorkspace.PopNullTool();
                    if (changes != null)
                    {
                        ((TransactedTool)this.documentWorkspace.Tool).RestoreChanges(changes);
                    }
                }
            }
            if (this.stepGroupDepth == 0)
            {
                this.OnFinishedStepGroup();
            }
        }