Esempio n. 1
0
 public void AddTool(ToolGroupItem tool)
 {
     this.tools.Add(tool);
     if (this.activeTool == null && tool.IsVisible)
     {
         this.DisplayTool(tool);
     }
     this.UpdateIsEnabled();
     this.OnPropertyChanged("ToolCount");
 }
Esempio n. 2
0
 public void SetActive(ToolGroupItem tool)
 {
     if (this.tools.Contains(tool))
     {
         this.IsChecked = new bool?(true);
         this.DisplayTool(tool);
     }
     else
     {
         this.IsChecked = new bool?(false);
     }
 }
Esempio n. 3
0
        private void ToolManager_ToolRemoved(object sender, ToolEventArgs args)
        {
            ToolGroupItem tool = this.toolToWrapperMapping[args.Tool];

            foreach (ToolGroupButton toolGroupButton in this.toolGroupButtons.Values)
            {
                if (toolGroupButton.RemoveTool(tool))
                {
                    break;
                }
            }
            this.toolToWrapperMapping.Remove(args.Tool);
        }
Esempio n. 4
0
        private void ToolManager_ActiveToolChanged(object sender, ToolEventArgs args)
        {
            ToolGroupItem tool = (ToolGroupItem)null;

            if (args.Tool != null)
            {
                this.toolToWrapperMapping.TryGetValue(args.Tool, out tool);
            }
            foreach (ToolGroupButton toolGroupButton in this.toolGroupButtons.Values)
            {
                toolGroupButton.SetActive(tool);
            }
        }
Esempio n. 5
0
 public bool RemoveTool(ToolGroupItem tool)
 {
     if (!this.tools.Remove(tool))
     {
         return(false);
     }
     if (this.activeTool == tool)
     {
         this.activeTool = (ToolGroupItem)null;
     }
     this.UpdateIsEnabled();
     this.OnPropertyChanged("ToolCount");
     return(true);
 }
Esempio n. 6
0
        private void Add(Tool tool)
        {
            ToolGroupButton toolGroupButton = (ToolGroupButton)null;

            if (!this.toolGroupButtons.TryGetValue(tool.Category, out toolGroupButton))
            {
                return;
            }
            ToolGroupItem tool1 = new ToolGroupItem(tool);

            toolGroupButton.AddTool(tool1);
            if (tool == this.toolManager.ActiveTool)
            {
                toolGroupButton.SetActive(tool1);
            }
            this.toolToWrapperMapping[tool] = tool1;
        }
Esempio n. 7
0
        private void DisplayTool(ToolGroupItem tool)
        {
            this.activeTool = tool;
            this.OnPropertyChanged("ActiveTool");
            if (this.ToolGroupActiveChanged != null)
            {
                this.ToolGroupActiveChanged((object)this, EventArgs.Empty);
            }
            this.DataContext = (object)tool;
            ContextMenu contextMenu = tool.CreateContextMenu();

            if (contextMenu != null)
            {
                this.ContextMenu = contextMenu;
            }
            else
            {
                this.ContextMenu = (ContextMenu)null;
            }
        }
Esempio n. 8
0
        private void RevalidateToolEnabledState()
        {
            SceneView activeView = this.designerContext.ActiveView;

            this.IsEnabled = activeView != null && activeView.IsDesignSurfaceEnabled;
            foreach (ToolGroupButton toolGroupButton in this.toolGroupButtons.Values)
            {
                ToolGroupItem activeTool = toolGroupButton.ActiveTool;
                toolGroupButton.UpdateIsEnabled();
                if (toolGroupButton.IsChecked.HasValue && toolGroupButton.IsChecked.Value)
                {
                    if (!toolGroupButton.IsEnabled || toolGroupButton.ActiveTool == null || !toolGroupButton.ActiveTool.IsVisible)
                    {
                        this.toolManager.ActiveTool = this.toolManager.Tools[0];
                    }
                    else if (activeTool != toolGroupButton.ActiveTool)
                    {
                        this.toolManager.ActiveTool = toolGroupButton.ActiveTool.Tool;
                    }
                }
            }
        }
Esempio n. 9
0
 public SwitchToolCommand(ToolGroupButton button, ToolGroupItem tool)
 {
     this.button = button;
     this.tool   = tool;
 }