コード例 #1
0
        public List <IShape> OnUndo()
        {
            if (!IsStackEmpty())
            {
                ToRedoStack.Push(ToUndoStack.Pop());

                var copy = ToUndoStack.Peek().Select(shape =>
                                                     shape is CompoundShape compoundShape ? GetAllCompoundShapeClones(compoundShape) : shape.Clone()
                                                     ).ToList();

                return(copy);
            }

            return(null);
        }
コード例 #2
0
 private bool IsStackEmpty()
 {
     return(ToUndoStack.Count == 1 && ToUndoStack.Peek().Count == 0);
 }