private void Button_Click(object sender, EventArgs e) { if (sender is PriorityButton) { var button = (PriorityButton)sender; if (button.Text == "0") { button.Text = (GetMaxPriorty() + 1).ToString(); button.BackColor = Color.LightGreen; } else if (button.Text == "1") { // Primary Alignment => do nothing } else { int priority = int.Parse(button.Text); button.Text = "0"; button.BackColor = Color.White; foreach (PriorityButton pButton in panelContent.Controls) { if (int.Parse(pButton.Text) > priority) { pButton.Text = (int.Parse(pButton.Text) - 1).ToString(); } } } } OnPriorityChanged?.Invoke(this, new EventArgs()); }
private void btnReset_Click(object sender, EventArgs e) { foreach (Button button in panelContent.Controls) { button.Text = "0"; button.BackColor = Color.White; } this.PrimarySymbolAlignment = _primaryAlignment; OnPriorityChanged?.Invoke(this, new EventArgs()); }