private void OptionsForm_FormClosing(object sender, FormClosingEventArgs e) { optionsForm.Invoke(new Action(() => { optionsForm.ConfigurationList.ListChanged -= ConfigurationList_ListChanged; optionsForm.FormClosing -= OptionsForm_FormClosing; })); optionsForm = null; }
private void Icon_Options(object sender, EventArgs e) { if (optionsForm == null || !optionsForm.Visible) { optionsForm = new ContextManagerOptionsForm(new List <ContextConfiguration>(configs), ConfigurationValidator); optionsForm.Show(); optionsForm.Invoke(new Action(() => { optionsForm.ConfigurationList.ListChanged += ConfigurationList_ListChanged; optionsForm.FormClosing += OptionsForm_FormClosing; })); } else if (optionsForm.Visible) { optionsForm.TopMost = true; } }