예제 #1
0
 /// <summary>
 /// 还原撤销
 /// </summary>
 public void Restore()
 {
     if (this.treeHandler != null && this.treeHandler.Tree.Root != null)
     {
         TreeMemento treeMemento = this.treeCaretaker.getPrevMemento();
         if (treeMemento != null)
         {
             this.treeHandler.Tree.Root = (Node)treeMemento.state.Clone();
             if (this.treeHandler.Tree.Root != null)
             {
                 this.BandIngTreeView(null, null);
                 this.state = PageState.Edit;
             }
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 保存修改
        /// </summary>
        public void AddMemento()
        {
            TreeMemento treeMemento = new TreeMemento((Node)this.treeHandler.Tree.Root.Clone());

            this.treeCaretaker.setMemento(treeMemento);
        }
 /// <summary>
 /// 从备忘录里还原
 /// </summary>
 /// <param name="memento"></param>
 public void restoreMemento(TreeMemento memento)
 {
     this.Tree.Root = memento.state;
 }