private void OnSelectedIndexChangedCategoryListBox(object sender, EventArgs e) { this._currentFactoryItem = null; this._factoryListView.Items.Clear(); FactoryCategory selectedItem = this._categoryListBox.SelectedItem as FactoryCategory; if (selectedItem != null) { foreach (ListViewItem item in selectedItem.Items) { this._factoryListView.Items.Add(item); } if (selectedItem.Items.Count != 0) { this._factoryListView.Items[0].Selected = true; } } }
private void OnSelectedIndexChangedFactoryListView(object sender, EventArgs e) { this._currentFactoryItem = null; if (this._factoryListView.SelectedItems.Count != 0) { this._currentFactoryItem = (FactoryListViewItem) this._factoryListView.SelectedItems[0]; } if (this._currentFactoryItem != null) { this._descriptionLabel.Text = this._currentFactoryItem.Factory.CreateNewDescription; this._okButton.Enabled = true; } else { this._descriptionLabel.Text = string.Empty; this._okButton.Enabled = false; } }
private void LoadFactories() { FactoryCategory category = new FactoryCategory("(General)"); this._factoryCategories = new HybridDictionary(true); this._factoryCategories.Add("General", category); FactoryCategory category2 = category; ImageList list = new ImageList(); ImageList list2 = new ImageList(); list.ImageSize = new Size(0x20, 0x20); list.ColorDepth = ColorDepth.Depth32Bit; this._factoryListView.LargeImageList = list; list2.ImageSize = new Size(0x10, 0x10); list2.ColorDepth = ColorDepth.Depth32Bit; this._factoryListView.SmallImageList = list2; ImageList.ImageCollection images = list.Images; ImageList.ImageCollection images2 = list2.Images; foreach (IProjectFactory factory in this._creatableProjectFactories) { images.Add(factory.LargeIcon); images2.Add(factory.SmallIcon); FactoryListViewItem item = new FactoryListViewItem(factory, images.Count - 1); string str = factory.Category; if ((str == null) || (str.Length == 0)) { category.Items.Add(item); continue; } FactoryCategory category3 = (FactoryCategory) this._factoryCategories[str]; if (category3 != null) { category3.Items.Add(item); } else { category3 = new FactoryCategory(str); category3.Items.Add(item); this._factoryCategories.Add(str, category3); } if (string.Compare(str, this._initialCategory, true) == 0) { category2 = category3; } } FactoryCategory category4 = null; foreach (FactoryCategory category5 in this._factoryCategories.Values) { if (category5.Items.Count != 0) { this._categoryListBox.Items.Add(category5); if (category4 == null) { category4 = category5; } } } if (category2.Items.Count == 0) { category2 = category4; } this._categoryListBox.SelectedItem = category2; this._categoryListBox.Focus(); }