/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { try { // dispose weblog profiles foreach (ListViewItem item in Items) { BlogSettings settings = item.Tag as BlogSettings; if (settings != null) { settings.Dispose(); } } } catch (Exception ex) { Trace.Fail("Unexpected exception disposing BlogSettings: " + ex.ToString()); } if (components != null) { components.Dispose(); } } base.Dispose(disposing); }
public void DeleteSelectedWeblog() { // delete the underlying profile SelectedWeblog.Delete(); // dispose the settings object BlogSettings settings = SelectedItems[0].Tag as BlogSettings; settings.Dispose(); // remove it from the list Items.Remove(SelectedItems[0]); // reselect the top-item (if one exists) if (TopItem != null) { TopItem.Selected = true; TopItem.Focused = true; } }