public void TakeOfAction(DrawingAction act) { if (!_drawingActions.Remove(act)) { throw new KeyNotFoundException("Drawing Action in Drawing Model"); } }
private void Draw(DrawingAction act) { if (act.Mode == DrawingTools.Pencil) { _drawingControl.DrawLine(act.LeftTop.X, act.LeftTop.Y, act.RightBottom.X, act.RightBottom.Y); } }
private void EnterCommander(DrawingTools mode, DrawingAction act) { if (mode == DrawingTools.Pencil) { _commander.Execute(new PencilCommand(this, act)); } }
public void SetPointUp(double x, double y) { _Clicked = false; _finalPoint = new Point(x, y); DrawingAction act = MakeAction(this._mode, _firstPoint, _finalPoint); EnterCommander(act.Mode, act); Refresh(); }
private DrawingAction MakeAction(DrawingTools mode, Point leftTop, Point rightBottom) { DrawingAction act = new DrawingAction(DrawingTools.None, _firstPoint, _finalPoint); if (mode == DrawingTools.Pencil) { act = new DrawingAction(mode, leftTop, rightBottom); } return(act); }
public void SetPointMove(double x, double y) { if (_Clicked == false || _mode == DrawingTools.None) { return; } // Console.WriteLine("Move at {0:F} {1:F}", x, y); Refresh(); _movePoint = new Point(x, y); DrawingAction act = MakeAction(this._mode, _firstPoint, _movePoint); Draw(act); //State.Move(_firstPoint,_movePoint) }
public void AddAnAction(DrawingAction act) { _drawingActions.Add(act); }