private void AddPlayerTool(PlayerColour colour) { var toolStripButton = new PlayerToolButton(); toolStripButton.Initialize(colour, toolSize, playerToolPadding); toolStripButton.Click += (s, e) => SelectPlayer(colour); playerTools.Add(toolStripButton); Items.Add(toolStripButton); }
public void SelectPlayer(PlayerColour colour) { var newPlayerTool = playerTools.Where(x => x.Player == colour).First(); if (selectedPlayerTool != null) { selectedPlayerTool.Select(false); } newPlayerTool.Select(true); selectedPlayerTool = newPlayerTool; PlayerSelected?.Invoke(this, new PlayerSelectedEventArgs(colour)); }