protected virtual void ParameterChanged(Parameters parameter) { if (parameter == m_Parameter) { bool bolSelected = Globals.ParameterValue(m_Parameter) == m_ParameterValue; SetSelectionGUI(bolSelected); if (bolSelected) { WasSelected?.Invoke(this, EventArgs.Empty); } } }
private void RoundButton_Click(object sender, EventArgs e) { // is also called indirectly if the button is triggered by other means if (Globals.CheckDiscardClick(this)) { return; } GUIUtilities.FocusIfNotInPalette(this.Parent); if (this.DesignMode || !m_Applicable || !Enabled) { return; // Or m_bolSelected - need to resend Tool=Measure in particular } if (m_Parameter != Parameters.None) { Globals.SetParameterValue(m_ParameterValue, m_Parameter); // it should raise the value changed event back again which will update the GUI } else { SetSelectionGUI(!m_Selected); UserChangedSelected?.Invoke(this, EventArgs.Empty); } WasSelected?.Invoke(this, EventArgs.Empty); }