private void AddToolGroupButton(ToolCategory category) { ToolGroupButton toolGroupButton = new ToolGroupButton(category.ToString(), category == ToolCategory.Asset); this.toolGroupButtons[category] = toolGroupButton; if (this.currentToolGroupPanel == null) { this.currentToolGroupPanel = this.ToolsRoot; } toolGroupButton.SetBinding(ToolGroupButton.ToolSelectionPlacementProperty, (BindingBase) new Binding() { Source = (object)this.ToolsRoot, Path = new PropertyPath("Orientation", new object[0]), Converter = (IValueConverter) new InverseOrientationToPopupPlacementConverter(), Mode = BindingMode.OneWay }); toolGroupButton.SetBinding(ToolPane.ParentOrientationProperty, (BindingBase) new Binding() { Source = (object)this.ToolsRoot, Path = new PropertyPath("Orientation", new object[0]) }); this.currentToolGroupPanel.Children.Add((UIElement)toolGroupButton); toolGroupButton.ToolGroupSelectionChanged += new EventHandler(this.ToolGroupButton_ToolGroupSelectionChanged); toolGroupButton.ToolGroupActiveChanged += new EventHandler(this.ToolGroupButton_ToolGroupActiveChanged); toolGroupButton.Focusable = false; }
private void ToolGroupButton_ToolGroupActiveChanged(object sender, EventArgs e) { ToolGroupButton toolGroupButton = sender as ToolGroupButton; if (toolGroupButton == null || toolGroupButton.ActiveTool == null) { return; } this.toolManager.SetCategoryActiveTool(toolGroupButton.ActiveTool.Tool.Category, toolGroupButton.ActiveTool.Tool); }
private void ToolGroupButton_ToolGroupSelectionChanged(object sender, EventArgs e) { ToolGroupButton toolGroupButton = sender as ToolGroupButton; if (toolGroupButton == null || toolGroupButton.ActiveTool == null) { return; } this.toolManager.ActiveTool = toolGroupButton.ActiveTool.Tool; }
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; }
public SwitchToolCommand(ToolGroupButton button, ToolGroupItem tool) { this.button = button; this.tool = tool; }