public void Execute(uint tick, ICommand <T> cmd) { #if DEBUG_SIMPLE_CHECK var iTick = (int)tick; for (int i = allCmds.Count; i <= iTick; i++) { allCmds.Add(null); } cmd.Do(_param); var node = new CommandNode(tick, cmd, _tail, null); allCmds[iTick] = node; #else if (cmd == null) { return; } cmd.Do(_param); var node = new CommandNode(tick, cmd, _tail, null); if (_head == null) { _head = node; _tail = node; return; } _tail.next = node; _tail = node; #endif }
public void Add(ICommand command, bool execute = true) { if (inUndoRedo) { return; } if (lastExecuted + 1 < commands.Count) { int numCommandsToRemove = commands.Count - (lastExecuted + 1); for (int i = 0; i < numCommandsToRemove; i++) { commands.RemoveAt(lastExecuted + 1); } lastSaved = -1; } commands.Add(command); lastExecuted = commands.Count - 1; if (execute) { command.Do(this); } OnChanged(true); }
//private static CommandsCollection instance; //public static CommandsCollection Default //{ // get // { // if (instance == null) // instance = new CommandsCollection(); // return instance; // } //} public void Do(ICommand command) { command.Do(); undoStack.Push(command); redoStack.Clear(); }
public void Do(ICommand cmd) { cmd.Do(); undoStack.Add(cmd); redoStack.Clear(); OverflowCheck(); }
public void ExeCommand(ICommand command) { if (command.Do()) { Push(command); } }
/// <summary> /// 保存当前行记录 /// </summary> /// <param name="ctx">当前数据项</param> public static void SaveContext(PanelContext ctx) { ctx.Row["ID"] = Utils.CreateGUID(); ICommand command = CommandFactory.GetCommand("add"); command.Do(ctx); }
/// <summary> /// Execute a command for XTMF /// </summary> /// <param name="command">The command to execute</param> /// <param name="error">In case of failure a description of the problem</param> /// <returns>If the command was successful or not. If not error will contain a string describing why</returns> internal bool ProcessCommand(ICommand command, ref string error) { // ensure only 1 command at a time lock (this) { return(command.Do(ref error)); } }
/// <summary> /// /// </summary> /// <param name="cmd"></param> /// <param name="input"></param> /// <returns></returns> public T Do(ICommand <T> cmd, T input) { T output = cmd.Do(input); _Undo.Push(cmd); _Redo.Clear(); // Once we issue a new command, the redo stack clears return(output); }
public T Do(ICommand <T> action, T input) { T result = action.Do(input); sRedo.Clear(); sUndo.Push(action); return(result); }
/// <summary> /// Выполнить команду /// </summary> /// <param name="cmd">Команда на выполнение</param> public void Do(ICommand cmd) { cmd.Do(); UndoStack.Push(cmd); RedoStack.Clear(); }
public void Prepare(ICommand command) { if (preparing != null) { throw new Exception("有正在进行的命令,暂时不能准备新命令"); } preparing = command; preparing.Do(); }
public void Do(ICommand <T> command) { T temp = this.Target; command.Do(ref temp); this.Target = temp; this.AddToStack(command, this.undo); }
public void Execute(int tick, ICommand cmd) { for (int i = _allCMds.Count; i <= tick; i++) { _allCMds.Add(new List <ICommand>()); } _allCMds[tick].Add(cmd); cmd.Do(_param); }
public void Redo() { if (hasRedoCommand) { ICommand cmd = redoStack.Pop(); cmd.Do(); undoStack.Add(cmd); } }
private bool Undo(ICommand command) { if (!command.Do(Scene)) { return(false); } _redoStack.Push(command); UpdateUI(); return(true); }
public void Do(ICommand command) { if (RedoList.Count > 0) { RedoList.Clear(); } command.Do(); UndoList.Push(command); }
/// <summary> /// 操作を実行し、かつその内容を履歴に追加します。 /// </summary> /// <param name="command">ICommandインターフェースを実装し、行う操作を定義したオブジェクト</param> public void Do(ICommand command) { this.undo.Push(command); this.CanUndo = this.undo.Count > 0; command.Do(); this.redo.Clear(); this.CanRedo = this.redo.Count > 0; }
/// <summary> /// 操作を実行し、かつその内容を履歴に追加します。 /// </summary> /// <param name="command">ICommandインターフェースを実装し、行う操作を定義したオブジェクト</param> private void Do(ICommand command) { this._Undo.Push(command); this.CanUndo = this._Undo.Count > 0; command.Do(); this.ClearRedoStack(); this.CanRedo = this._Redo.Count > 0; }
public void Do(ICommand command) { if(RedoList.Count > 0) { RedoList.Clear(); } command.Do(); UndoList.Push(command); }
public void ExecuteCommand(ICommand command) { command.Do(); _doneCommands.Push(command); if (_undoneCommands.Count > 0) { _undoneCommands.Clear(); } }
void Redo() { if (redostack.Count == 0) { return; } ICommand cmd = redostack.Pop(); undostack.Push(cmd); cmd.Do(); }
public void Do() { if (RedoStack.Count == 0) { return; } ICommand currentundo = RedoStack.Pop(); UndoStack.Push(currentundo); currentundo.Do(); }
void AddCommand(ICommand command) { if (command == null) { return; } command.Do(); undostack.Push(command); redostack.Clear(); }
public void Redo(Type commandType) { ICommand <T> command = this.MoveFromStackToStack(commandType, this.redo, this.undo); if (command != null) { T temp = this.Target; command.Do(ref temp); this.Target = temp; } }
public void Redo() { if (hasRedoCommand) { ICommand cmd = redoStack[RedoCount - 1]; cmd.Do(); redoStack.Remove(cmd); undoStack.Add(cmd); } }
public static void Redo() { if (Redos.Count <= 0) { return; } ICommand command = Redos.Pop(); command.Do(); Undos.Push(command); }
public T Redo(T input) { if (sRedo.Count > 0) { ICommand <T> action = sRedo.Pop(); T result = action.Do(input); sUndo.Push(action); return(result); } return(input); }
private bool Redo(ICommand command, bool spoof = false) { var result = spoof || command.Do(Scene); if (result) { UndoStack.Push(command); UpdateUI(); } return(result); }
void AutoEditor_OnInteralCommand(object sender, ModelEventArgs args) { if (!args.Disable) { ICommand cmd = CommandFactory.GetCommand(args.CommandName); if (cmd == null) { throw new SysException(cmd + "模型命令不存在"); } args.State = cmd.Do(args.PanelContext); } }
protected virtual bool DoExecute(ICommand command) { try { command.Do(); return(true); } catch (CommandExecutionCancelledException) { return(false); } }
public void Do(ICommand _command) { if (_command == null) { return; } this.undo.Push(_command); this.CanUndo = true; _command.Do(); this.redo.Clear(); this.CanRedo = false; }
public void Redo(TiledMapDataContainer container) { if (m_redoCommandStack.Count == 0) { throw new Exception("No commands to redo"); } ICommand command = m_redoCommandStack.Pop(); command.Do(container); m_undoCommandStack.Push(command); }
public void Do(ICommand command, TiledMapDataContainer container) { command.Do(container); m_undoCommandStack.Push(command); m_redoCommandStack.Clear(); }
public void Add(ICommand command, bool execute = true) { if (lastExecuted + 1 < commands.Count) { int numCommandsToRemove = commands.Count - (lastExecuted + 1); for (int i = 0; i < numCommandsToRemove; i++) { commands.RemoveAt(lastExecuted + 1); } lastSaved = -1; } commands.Add(command); lastExecuted = commands.Count - 1; if (execute) { command.Do(this); } OnChanged(true); }
void Redo(ICommand c) { c.Do(this); undoStack.Push(c); UndoCapabilityChanged(); }
public void Do(ICommand command) { command.Do(); undoStack.Push(command); }
public void Do(ICommand command) { if (CanUndo) { if (m_undoStack.Peek ().Chain (command)) return; } m_redoStack.Clear (); command.Do (); if (command.CanUndo) m_undoStack.Push (command); if (Changed != null) Changed (this, new EventArgs ()); }
protected virtual bool DoExecute(ICommand command) { try { command.Do(); return true; } catch (CommandExecutionCancelledException) { return false; } }