private void ToggleTools(DnDMapConstants.Tool newTool) { // Ignore any tool toggling if we're not even allowing commands yet. if (!gbxCommands.Enabled) return; this.DnDMapControl.CurrentTool = newTool; // Change the enabledness & colors as needed. if (newTool == DnDMapConstants.Tool.SelectTool) { btnSelectTool.Enabled = false; btnSelectTool.BackColor = DnDMapConstants.SelectedToolColor; btnFogRemoveTool.Enabled = true; btnFogRemoveTool.BackColor = initialFogRemoveToolColor; btnFogAddTool.Enabled = true; btnFogAddTool.BackColor = initialFogAddToolColor; } else if (newTool == DnDMapConstants.Tool.FogRemoveTool) { btnFogRemoveTool.Enabled = false; btnFogRemoveTool.BackColor = DnDMapConstants.SelectedToolColor; btnSelectTool.Enabled = true; btnSelectTool.BackColor = initialSelectToolColor; btnFogAddTool.Enabled = true; btnFogAddTool.BackColor = initialFogAddToolColor; } else if (newTool == DnDMapConstants.Tool.FogAddTool) { btnFogAddTool.Enabled = false; btnFogAddTool.BackColor = DnDMapConstants.SelectedToolColor; btnSelectTool.Enabled = true; btnSelectTool.BackColor = initialSelectToolColor; btnFogRemoveTool.Enabled = true; btnFogRemoveTool.BackColor = initialFogRemoveToolColor; } else { throw new NotImplementedException(); } currentTool = newTool; }
public void EnableControlPanel(DnDMapConstants.Tool initialTool = DnDMapConstants.Tool.SelectTool) { foreach (var c in gbxCommands.Controls.OfType<Control>().Concat(gbxGridSize.Controls.OfType<Control>()).Concat(gbxLog.Controls.OfType<Control>())) c.Enabled = true; ToggleTools(initialTool); }