예제 #1
0
 public void TakeOfAction(DrawingAction act)
 {
     if (!_drawingActions.Remove(act))
     {
         throw new KeyNotFoundException("Drawing Action in Drawing Model");
     }
 }
예제 #2
0
 private void Draw(DrawingAction act)
 {
     if (act.Mode == DrawingTools.Pencil)
     {
         _drawingControl.DrawLine(act.LeftTop.X, act.LeftTop.Y, act.RightBottom.X, act.RightBottom.Y);
     }
 }
예제 #3
0
 private void EnterCommander(DrawingTools mode, DrawingAction act)
 {
     if (mode == DrawingTools.Pencil)
     {
         _commander.Execute(new PencilCommand(this, act));
     }
 }
예제 #4
0
        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();
        }
예제 #5
0
        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);
        }
예제 #6
0
        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)
        }
예제 #7
0
 public void AddAnAction(DrawingAction act)
 {
     _drawingActions.Add(act);
 }