Ejemplo n.º 1
0
 public void DoCommandTest()
 {
     Point startPoint = new Point(10, 10);
     Point endPoint = new Point(20, 20);
     Shape rectangle = ShapeFactory.CreatShape(Mode.Rectangle, startPoint, endPoint);
     Command command = new AddShapeCommand(rectangle, _shapeModel);
     _commandManagerTarget.DoCommand(command);
     Assert.AreEqual(1, _commandManagerTarget._undoList.Count);
     Assert.AreEqual(0, _commandManagerTarget._redoList.Count);
 }
Ejemplo n.º 2
0
        // 放開滑鼠
        public override void ReleaseMouse(Point point)
        {
            if (_drawingShape != null)
            {
                Command command = new AddShapeCommand(_drawingShape, _shapeModel);
                if (_drawingShape.Width != 0 & _drawingShape.Height != 0)
                {
                    _shapeModel.DoCommand(command);
                }
                _drawingShape.IsSelect = false;
            }

            _drawingShape = null;
            _mousePressed = false;
        }