Exemplo n.º 1
0
        public override HistoryMemento PerformAction(DocumentWorkspace documentWorkspace)
        {
            HistoryMemento memento          = null;
            int            activeLayerIndex = documentWorkspace.ActiveLayerIndex;

            if (activeLayerIndex != (documentWorkspace.Document.Layers.Count - 1))
            {
                HistoryMemento   memento2 = new SwapLayerFunction(activeLayerIndex, activeLayerIndex + 1).Execute(documentWorkspace);
                HistoryMemento[] actions  = new HistoryMemento[] { memento2 };
                memento = new CompoundHistoryMemento(StaticName, StaticImage, actions);
                documentWorkspace.ActiveLayer = (Layer)documentWorkspace.Document.Layers[activeLayerIndex + 1];
            }
            return(memento);
        }
Exemplo n.º 2
0
        public override HistoryMemento PerformAction(DocumentWorkspace documentWorkspace)
        {
            HistoryMemento hm    = null;
            int            index = documentWorkspace.ActiveLayerIndex;

            if (index != documentWorkspace.Document.Layers.Count - 1)
            {
                SwapLayerFunction slf   = new SwapLayerFunction(index, index + 1);
                HistoryMemento    slfhm = slf.Execute(documentWorkspace);

                hm = new CompoundHistoryMemento(
                    StaticName,
                    StaticImage,
                    new HistoryMemento[] { slfhm });

                documentWorkspace.ActiveLayer = (Layer)documentWorkspace.Document.Layers[index + 1];
            }

            return(hm);
        }