Ejemplo n.º 1
0
        public Momento undo(Momento currentScreen)
        {
            Momento tempMomento = actionList.Last();

            //undoneList.Add(tempMomento);
            if (firstUndo == 0)
            {
                undoneList.Clear();
                undoneList.Add(new Momento(currentScreen.getCanvasGraphicList()));
                firstUndo = 1;
                return(new Momento(tempMomento.getCanvasGraphicList()));
            }
            else
            {
                actionList.Remove(tempMomento);
                undoneList.Add(new Momento(tempMomento.getCanvasGraphicList()));
                if (actionList.Any())
                {
                    return(new Momento(actionList.Last().getCanvasGraphicList()));
                }
                else
                {
                    return(new Momento(tempMomento.getCanvasGraphicList()));
                }
            }
        }
Ejemplo n.º 2
0
        public Momento redo()
        {
            Momento tempMomento = undoneList.Last();

            actionList.Add(new Momento(tempMomento.getCanvasGraphicList()));
            undoneList.Remove(tempMomento);
            return(new Momento(tempMomento.getCanvasGraphicList()));
        }
Ejemplo n.º 3
0
 public void add(Momento action)
 {
     if (firstUndo == 1)
     {
         firstUndo = 0;
     }
     else
     {
         actionList.Add(action);
     }
     undoneList.Clear();
 }