public ToolButton(ControllerEditor controller, Tool tool, BitmapImage image) { InitializeComponent(); _tool = tool; _controller = controller; if (image != null) { Button.Content = new System.Windows.Controls.Image { Source = image, VerticalAlignment = VerticalAlignment.Center }; } Button.Click += Button_Click; }
private void _setTool(Tool tool) { Debug.Assert(tool != null, "Tool cannot be null."); if (_activeTool == _nextTool) { return; } _activeTool.Disable(); _activeTool = tool; _activeTool.Enable(); ToolChanged(this, tool); }
private void InitTools() { _toolDefault = new ToolDefault(this); _activeTool = _toolDefault; _nextTool = _activeTool; _activeTool.Enable(); }
public void SetTool(Tool tool) { if (tool == null) { _nextTool = _toolDefault; } else { _nextTool = tool; } }
private void ControllerEditor_ToolChanged(ControllerEditor controller, Tool tool) { MainWindow.Invoke(() => { if (ButtonMap.ContainsKey(tool)) { ButtonMap[tool].Button.IsChecked = true; } else { foreach (ToolButton button in ButtonMap.Values) { button.Button.IsChecked = false; } } }); }
private void AddButton(ControllerEditor controller, Tool tool, BitmapImage buttonImage) { ToolButton button = new ToolButton(controller, tool, buttonImage); ToolGrid.Children.Add(button); ButtonMap.Add(tool, button); }