//Dictionary<string, Stack<IGraphCommand>> Diccommands = new Dictionary<string, Stack<IGraphCommand>>(); public Bitmap Draw(IGraphCommand command, bool AddUndo = true) { if (DicUndocommands.ContainsKey(CurrentWindow)) { UndoBitmaps = DicUndocommands[CurrentWindow]; RedoBitmaps = DicRedocommands[CurrentWindow]; } else { UndoBitmaps = new Stack <Bitmap>(); RedoBitmaps = new Stack <Bitmap>(); DicUndocommands.Add(CurrentWindow, UndoBitmaps); DicRedocommands.Add(CurrentWindow, RedoBitmaps); } if (command is PenDraw) { if (Config.parameter.iParameter[0] == 1) { //Undocommands.Push(command); UndoBitmaps.Push(command.bitmap); RedoBitmaps.Clear(); //Redocommands.Clear(); } } else if (AddUndo) { //Undocommands.Push(command); UndoBitmaps.Push(command.bitmap); RedoBitmaps.Clear(); // Redocommands.Clear(); } return(command.Draw()); }
public void AddCommand(FunctionType functionType, IGraphCommand graphCommand) { Commands.Add(functionType, graphCommand); }
public void Undo() { IGraphCommand command = commands.Pop(); command.Undo(); }
public void Draw(IGraphCommand command) { command.Draw(); commands.Push(command); }