public void btnRemoveComponent_Click(System.Object sender, System.EventArgs e) { try { if (this.lstComponents.Items.Count <= 0) { throw (new Exception("No components to delete")); } if (this.lstComponents.SelectedIndex < 0) { throw (new Exception("No component selected from list")); } string componentNAme = System.Convert.ToString(this.lstComponents.SelectedItem); System.Windows.Forms.TabPage tabPage = (System.Windows.Forms.TabPage) this._handlersTabPagesTable[componentNAme]; CF_CNDCommsEnvironment_ComponentHandler handler = (CF_CNDCommsEnvironment_ComponentHandler)this._handlersTable[componentNAme]; handler.DisposeHandler(); this.tabComponentHandlers.TabPages.Remove(tabPage); this.lstComponents.Items.Remove(componentNAme); this._handlersTable.Remove(componentNAme); this._handlersTabPagesTable.Remove(componentNAme); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void DisposeContainer() { try { IEnumerator enumm = this._handlersTable.GetEnumerator(); CF_CNDCommsEnvironment_ComponentHandler handler = default(CF_CNDCommsEnvironment_ComponentHandler); while (enumm.MoveNext()) { handler = (CF_CNDCommsEnvironment_ComponentHandler)(((DictionaryEntry)enumm.Current).Value); handler.DisposeHandler(); } } catch (Exception) { } }