示例#1
0
        //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());
        }
示例#2
0
 public void AddCommand(FunctionType functionType, IGraphCommand graphCommand)
 {
     Commands.Add(functionType, graphCommand);
 }
示例#3
0
        public void Undo()
        {
            IGraphCommand command = commands.Pop();

            command.Undo();
        }
示例#4
0
 public void Draw(IGraphCommand command)
 {
     command.Draw();
     commands.Push(command);
 }