コード例 #1
0
 public void DeleteFigures(IEnumerable <IFigure> figures)
 {
     foreach (IFigure figure in figures)
     {
         DrawingView.Remove(figure);
     }
     DrawingView.ClearSelection();
 }
コード例 #2
0
 public override bool Undo()
 {
     if (base.Undo() && AffectedFigures.Count() > 0)
     {
         DrawingView.ClearSelection();
         AffectedFigures = _command.InsertFigures(AffectedFigures.Reverse().ToFigures(), 0, 0);
         return(true);
     }
     return(false);
 }
コード例 #3
0
ファイル: DuplicateCommand.cs プロジェクト: thbin/TraceLab
        public override void Execute()
        {
            base.Execute();
            UndoActivity = CreateUndoActivity();
            FigureCollection figures = new FigureCollection(DrawingView.SelectionEnumerator).Clone();

            UndoActivity.AffectedFigures = figures;
            DrawingView.ClearSelection();
            UndoActivity.AffectedFigures = base.InsertFigures(UndoActivity.AffectedFigures, 10, 10);
        }
コード例 #4
0
            public override bool Redo()
            {
                // do not call execute directly as the selection might has changed
                if (Redoable == false)
                {
                    return(false);
                }

                _command.DeleteFigures(AffectedFigures.ToFigures());
                DrawingView.ClearSelection();
                return(true);
            }
コード例 #5
0
ファイル: SelectAllCommand.cs プロジェクト: thbin/TraceLab
            public override bool Undo()
            {
                if (base.Undo() == false)
                {
                    return(false);
                }

                DrawingView.ClearSelection();
                DrawingView.AddToSelection(AffectedFigures.ToFigures());

                return(true);
            }
コード例 #6
0
            public override bool Undo()
            {
                // TODO: This doesn't seem neccesary
                if (base.Undo() == false)
                {
                    return(false);
                }

                DeleteFromDrawingVisitor visitor = new DeleteFromDrawingVisitor(DrawingView.Drawing);

                foreach (IFigure figure in AffectedFigures)
                {
                    figure.Visit(visitor);
                }
                DrawingView.ClearSelection();

                return(true);
            }