public void Set(ExtensionCollection collection, bool isListOfInstalledExtensions) { var oldCursor = ParentForm.Cursor; try { ParentForm.Cursor = Cursors.WaitCursor; flowLayoutPanel1.SuspendLayout(); collection.Sort(false); comboBox1.Items.Clear(); comboBox1.Items.Add("All"); TagList.Clear(); toolTip1.RemoveAll(); // removes all created user-objects for the tooltip - reuse this tooltip instance, otherwise memory leak! foreach (Control c in flowLayoutPanel1.Controls) { c.Dispose(); } flowLayoutPanel1.Controls.Clear(); foreach (PackageClass item in collection.Items) { var extHostCtrl = new ExtensionControlHost(); flowLayoutPanel1.Controls.Add(extHostCtrl); extHostCtrl.Initialize(item, isListOfInstalledExtensions); AddTags(item.GeneralInfo.TagList); } comboBox1.Text = "All"; textBox1.Text = string.Empty; foreach (KeyValuePair <string, int> tagList in TagList) { if (tagList.Value > 1) { comboBox1.Items.Add(tagList.Key); } } flowLayoutPanel1.ResumeLayout(); flowLayoutPanel1_SizeChanged(this, EventArgs.Empty); } finally { ParentForm.Cursor = oldCursor; } }
public void Set(ExtensionCollection collection, bool isListOfInstalledExtensions) { var oldCursor = ParentForm.Cursor; try { ParentForm.Cursor = Cursors.WaitCursor; flowLayoutPanel1.SuspendLayout(); collection.Sort(false); comboBox1.Items.Clear(); comboBox1.Items.Add("All"); TagList.Clear(); toolTip1.RemoveAll(); // removes all created user-objects for the tooltip - reuse this tooltip instance, otherwise memory leak! foreach (Control c in flowLayoutPanel1.Controls) c.Dispose(); flowLayoutPanel1.Controls.Clear(); foreach (PackageClass item in collection.Items) { var extHostCtrl = new ExtensionControlHost(); flowLayoutPanel1.Controls.Add(extHostCtrl); extHostCtrl.Initialize(item, isListOfInstalledExtensions); AddTags(item.GeneralInfo.TagList); } comboBox1.Text = "All"; textBox1.Text = string.Empty; foreach (KeyValuePair<string, int> tagList in TagList) { if (tagList.Value > 1) comboBox1.Items.Add(tagList.Key); } flowLayoutPanel1.ResumeLayout(); flowLayoutPanel1_SizeChanged(this, EventArgs.Empty); } finally { ParentForm.Cursor = oldCursor; } }