示例#1
0
        private void AssembleTool()
        {
            if (CurrentTool != null && CurrentTool is IDisposable)
            {
                ((IDisposable)CurrentTool).Dispose();
            }

            switch (currentToolType)
            {
                case ToolType.Cursor:
                    CurrentTool = new CursorTool();
                    break;

                case ToolType.Brush:
                    CurrentTool = null;
                    if (CurrentBrush != null) CurrentTool = new BrushTool(CurrentBrush);
                    break;

                case ToolType.Bucket:
                    CurrentTool = null;
                    if (CurrentBrush != null) CurrentTool = new Bucket(CurrentBrush);
                    break;

                case ToolType.Join:
                    CurrentTool = new JoinTool();
                    break;

                case ToolType.Start:
                    CurrentTool = new StartPositionTool();
                    break;

                case ToolType.Entity:
                    CurrentTool = new EntityTool(currentEntity);
                    break;

                case ToolType.Zoom:
                    CurrentTool = new Zoom();
                    break;

                case ToolType.Rectangle:
                    CurrentTool = null;
                    if (CurrentBrush != null) CurrentTool = new RectangleTool(CurrentBrush);
                    break;

                case ToolType.Selection:
                    CurrentTool = new SelectionTool();
                    break;
            }

            if (currentToolType != ToolType.Entity) entityForm.Deselect();
        }
示例#2
0
        private void AssembleTool()
        {
            if (CurrentTool != null && CurrentTool is IDisposable)
            {
                ((IDisposable)CurrentTool).Dispose();
            }

            switch (currentToolType)
            {
            case ToolType.Cursor:
                CurrentTool = new CursorTool();
                break;

            case ToolType.Brush:
                CurrentTool = null;
                if (CurrentBrush != null)
                {
                    CurrentTool = new BrushTool(CurrentBrush);
                }
                break;

            case ToolType.Bucket:
                CurrentTool = null;
                if (CurrentBrush != null)
                {
                    CurrentTool = new Bucket(CurrentBrush);
                }
                break;

            case ToolType.Join:
                CurrentTool = new JoinTool();
                break;

            case ToolType.Start:
                CurrentTool = new StartPositionTool();
                break;

            case ToolType.Entity:
                CurrentTool = new EntityTool(currentEntity);
                break;

            case ToolType.Zoom:
                CurrentTool = new Zoom();
                break;

            case ToolType.Rectangle:
                CurrentTool = null;
                if (CurrentBrush != null)
                {
                    CurrentTool = new RectangleTool(CurrentBrush);
                }
                break;

            case ToolType.Selection:
                CurrentTool = new SelectionTool();
                break;
            }

            if (currentToolType != ToolType.Entity)
            {
                entityForm.Deselect();
            }
        }