/// <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(); } } }
/// <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(); } } }
/// <summary> /// Constructor. /// </summary> public OpenDocumentTask(string file, object caller, CadKit.Interfaces.ICommand command) : base(file, caller) { // Set members. _command = command; }