Example #1
0
        public void Execute(params string[] parameters)
        {
            if (parameters.Length > 0)
            {
                Console.WriteLine("undo не нужны аргументы");
                return;
            }
            var shapes = CommandHistoryContainer.GetInstance().OnUndo();

            if (shapes == null)
            {
                Console.WriteLine("Нет действий, которые можно было бы откатить");
                return;
            }

            var currentShapes = picture.shapes;

            foreach (var shape in currentShapes.ToList())
            {
                picture.Remove(shape);
            }

            foreach (var shape in shapes)
            {
                picture.Add(shape);
            }

            SelectionContainer.GetInstance().OnUndo(picture.shapes);
        }
 public void Execute(params string[] parameters)
 {
     picture.Remove(parameters);
 }