private void FormInstanceClosing(object sender, System.ComponentModel.CancelEventArgs e) { lock (_lockObj) { _formInstance.Closing -= FormInstanceClosing; _formInstance = null; } }
private void btnContacts_Click(object sender, System.EventArgs e) { ContactsListForm contactsListForm = new ContactsListForm(); contactsListForm.EmailAdded += EmailAdded; contactsListForm.ShowDialog(); }
protected override void ExecuteCommand(object sender, object data) { lock (_lockObj) { if (_formInstance == null) { _formInstance = new ContactsListForm(Plugin.PluginManager.Core.ContactsManager); _formInstance.Closing += FormInstanceClosing; } _formInstance.Show(); } }