public void DeleteFigures(IEnumerable <IFigure> figures) { foreach (IFigure figure in figures) { DrawingView.Remove(figure); } DrawingView.ClearSelection(); }
public override bool Undo() { if (base.Undo() && AffectedFigures.Count() > 0) { DrawingView.ClearSelection(); AffectedFigures = _command.InsertFigures(AffectedFigures.Reverse().ToFigures(), 0, 0); return(true); } return(false); }
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); }
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); }
public override bool Undo() { if (base.Undo() == false) { return(false); } DrawingView.ClearSelection(); DrawingView.AddToSelection(AffectedFigures.ToFigures()); return(true); }
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); }