/// <summary> /// Initializes a new instance of the <see cref="MouseSpeedStyleForm" /> class. /// </summary> /// <param name="initialStyle">The initial style.</param> /// <param name="defaultStyle">The default style to revert to when the override checkbox is unchecked.</param> public MouseSpeedStyleForm(MouseSpeedIndicatorStyle initialStyle, MouseSpeedIndicatorStyle defaultStyle) { this.defaultStyle = defaultStyle ?? throw new ArgumentNullException(nameof(defaultStyle)); this.initialStyle = initialStyle; this.currentStyle = (MouseSpeedIndicatorStyle)initialStyle?.Clone(); this.InitializeComponent(); }
/// <summary> /// Initializes a new instance of the <see cref="MouseSpeedStyleForm" /> class. /// </summary> /// <param name="initialStyle">The initial style.</param> /// <param name="defaultStyle">The default style to revert to when the override checkbox is unchecked.</param> public MouseSpeedStyleForm(MouseSpeedIndicatorStyle initialStyle, MouseSpeedIndicatorStyle defaultStyle) { if (defaultStyle == null) throw new ArgumentNullException(nameof(defaultStyle)); this.initialStyle = initialStyle; this.defaultStyle = defaultStyle; this.currentStyle = initialStyle; this.InitializeComponent(); }
/// <summary> /// Toggles the overwriting of the default style. /// </summary> private void chkOverwrite_CheckedChanged(object sender, EventArgs e) { this.defaultMouseSpeed.Enabled = this.chkOverwrite.Checked; if (this.chkOverwrite.Checked) { this.currentStyle = this.initialStyle ?? this.defaultStyle; this.defaultMouseSpeed.IndicatorStyle = this.currentStyle; } else { this.currentStyle = null; } this.StyleChanged?.Invoke(this.currentStyle); }
/// <summary> /// Handles change of the style, sets the new style and invokes the changed event. /// </summary> /// <param name="style">The new style.</param> private void defaultMouseSpeed_IndicatorStyleChanged(MouseSpeedIndicatorStyle style) { this.currentStyle = style; this.StyleChanged?.Invoke(style); }