コード例 #1
0
ファイル: Draw.cs プロジェクト: needcash/PaintForTheWin
 public Draw(int actionToChange, Tool tool, Point startingPosition, IDrawingStrategy strategy)
 {
     _tool = tool;
     _startingPoint = startingPosition;
     _currentPoint = startingPosition;
     _drawingStrategy = strategy;
     _actionToChange = actionToChange;
     _addedElements = new List<UIElement>();
 }
コード例 #2
0
        public void DrawShape(IShape shape, string s)
        {
            IDrawingStrategy strategy = null;

            if (s.ToLower() == "circle")
            {
                strategy = new Circle();
            }
            else if (s.ToLower() == "square")
            {
                strategy = new Square();
            }
            else if (s.ToLower() == "rectangle")
            {
                strategy = new Rectangle();
            }

            strategy.DrawShape(shape);
        }
コード例 #3
0
 public VideoCard(bool isColorful, IDrawingStrategy drawingStrategy)
 {
     this.IsColorful      = isColorful;
     this.DrawingStrategy = drawingStrategy;
 }
コード例 #4
0
        public void Draw(IShape shape)
        {
            IDrawingStrategy drawer = strategies.First(s => s.isMatch(shape));

            drawer.Draw(shape);
        }