示例#1
0
文件: History.cs 项目: perryiv/cadkit
 /// <summary>
 /// Add the recently executed command.
 /// </summary>
 void CadKit.Interfaces.ICommandHistory.add(object command)
 {
     CadKit.Interfaces.ICommand cmd = command as CadKit.Interfaces.ICommand;
     if (null != cmd)
     {
         using (this.Lock.write())
         {
             _done.Push(cmd);
             _undone.Clear();
         }
     }
 }
示例#2
0
文件: History.cs 项目: perryiv/cadkit
        /// <summary>
        /// Redo the command that was last undone.
        /// </summary>
        void CadKit.Interfaces.ICommandHistory.redo()
        {
            if (true == this.CanRedo)
            {
                // Move the command over to the "done" stack before we execute.
                CadKit.Interfaces.ICommand command = null;
                using (this.Lock.read())
                {
                    command = _undone.Pop();
                }
                if (null != command)
                {
                    using (this.Lock.write())
                    {
                        _done.Push(command);
                    }

                    // Execute the command. This may throw.
                    command.execute();
                }
            }
        }
示例#3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public OpenDocumentTask(string file, object caller, CadKit.Interfaces.ICommand command)
     : base(file, caller)
 {
     // Set members.
     _command = command;
 }