Пример #1
0
        public static void SetTool(Tool tool)
        {
            if (SelectedTool != null && tool != SelectedTool)
            {
                SelectedTool.Stop();
                SelectedTool.OnChangingTool();
            }

            if (tool == CurrentTools.HandTool)
            {
                _selected = HandTool;
                HandTool.Stop();
                _quickpan = false;
            }
            else if (tool == CurrentTools.LineTool)
            {
                _selected = LineTool;
            }
            else if (tool == CurrentTools.BezierTool)
            {
                _selected = BezierTool;
            }
            else if (tool == CurrentTools.PencilTool)
            {
                _selected = PencilTool;
            }
            else if (tool == CurrentTools.EraserTool)
            {
                if (SelectedTool == EraserTool)
                {
                    EraserTool.Swatch.Selected = LineType.All;
                }
                _selected = EraserTool;
            }
            else if (tool == CurrentTools.MoveTool)
            {
                if (SelectedTool == MoveTool)
                {
                    MoveTool.Swatch.Selected = LineType.All;
                }
                _selected = MoveTool;
            }
            else if (tool == CurrentTools.SelectTool)
            {
                if (SelectedTool == SelectTool)
                {
                    SelectTool.Swatch.Selected = LineType.All;
                }
                _selected = SelectTool;
            }
        }