public void ToggleEnable(bool enabled) { if (_config.enabled != enabled) { _config.enabled = enabled; SaveConfig(_config); if (EnableChanged != null) { EnableChanged.Invoke(this, new EventArgs()); } } }
private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (!EnableChanged.Invoke(this, checkBox1.Checked)) { checkBox1.CheckedChanged -= checkBox1_CheckedChanged; checkBox1.Checked = true; checkBox1.CheckedChanged += checkBox1_CheckedChanged; return; } textBox1.Enabled = checkBox1.Checked; minMaxLabel1.Visible = checkBox1.Checked; timer1.Stop(); timer1.Start(); if (checkBox1.Checked) { ContextMenuStrip = contextBKP; } else { contextBKP = ContextMenuStrip; ContextMenuStrip = null; } }
protected void DoEnableChanged() { EnableChanged?.Invoke(this, EventArgs.Empty); OnEnableChanged(); }
protected virtual void OnEnableChanged(EventArgs Args) => EnableChanged?.Invoke(this, Args);
private void Enable_Changed(object sender, RoutedEventArgs e) { EnableChanged?.Invoke(this, new EventArgs()); }