private void SelectList_SelectedIndexChanged(object sender, EventArgs e) { if (SelectProperties != null) { SelectProperties.Remove(); } SelectProperties = new PropertyBox(); SelectProperties.Location = new Point(SelectList.Right + 3, SelectList.Top); SelectProperties.ListPropertiesOnly = true; SelectProperties.SelectedIndexChanged += new EventHandler(SelectSubListChanged); this.Controls.Add(SelectProperties); switch (SelectList.SelectedItem.ToString()) { case "Historical Figures": SearchList = new SearchList <HistoricalFigure>(World.HistoricalFigures); SelectProperties.ParentType = typeof(HistoricalFigure); break; case "Entities": SearchList = new SearchList <Entity>(World.Entities); SelectProperties.ParentType = typeof(Entity); break; case "Sites": SearchList = new SearchList <Site>(World.Sites); SelectProperties.ParentType = typeof(Site); break; case "Regions": SearchList = new SearchList <WorldRegion>(World.Regions); SelectProperties.ParentType = typeof(WorldRegion); break; case "Underground Regions": SearchList = new SearchList <UndergroundRegion>(World.UndergroundRegions); SelectProperties.ParentType = typeof(UndergroundRegion); break; case "Wars": SearchList = new SearchList <War>(World.Wars); SelectProperties.ParentType = typeof(War); break; case "Battles": SearchList = new SearchList <Battle>(World.Battles); SelectProperties.ParentType = typeof(Battle); break; case "Conquerings": SearchList = new SearchList <SiteConquered>(World.EventCollections.OfType <SiteConquered>().ToList()); SelectProperties.ParentType = typeof(SiteConquered); break; case "Beast Attacks": SearchList = new SearchList <BeastAttack>(World.BeastAttacks); SelectProperties.ParentType = typeof(BeastAttack); break; case "Artifacts": SearchList = new SearchList <Artifact>(World.Artifacts); SelectProperties.ParentType = typeof(Artifact); break; } if (SelectProperties.ParentType == typeof(Site) || SelectProperties.ParentType == typeof(Battle)) { btnMapResults.Visible = true; } SelectionPanel.Clear(); SelectionPanel.CriteriaType = SearchList.GetMainListType(); SearchPanel.CriteriaType = SelectProperties.GetLowestPropertyType(); OrderByPanel.CriteriaType = SelectProperties.GetLowestPropertyType(); SelectSubListChanged(this, null); //lblSelectCriteria.Text = "Select " + SelectList.Text + " Where:"; //lblSearchCriteria.Text = "Search " + SelectList.Text + " Where:"; //lblOrderCriteria.Text = "Order " + SelectList.Text + " By:"; }
private void SelectList_SelectedIndexChanged(object sender, EventArgs e) { _selectProperties?.Remove(); _selectProperties = new PropertyBox { Location = new Point(SelectList.Right + 3, SelectList.Top), ListPropertiesOnly = true }; _selectProperties.SelectedIndexChanged += SelectSubListChanged; Controls.Add(_selectProperties); switch (SelectList.SelectedItem.ToString()) { case "Historical Figures": _searchList = new SearchList <HistoricalFigure>(World.HistoricalFigures); _selectProperties.ParentType = typeof(HistoricalFigure); break; case "Entities": _searchList = new SearchList <Entity>(World.Entities); _selectProperties.ParentType = typeof(Entity); break; case "Sites": _searchList = new SearchList <Site>(World.Sites); _selectProperties.ParentType = typeof(Site); break; case "Regions": _searchList = new SearchList <WorldRegion>(World.Regions); _selectProperties.ParentType = typeof(WorldRegion); break; case "Underground Regions": _searchList = new SearchList <UndergroundRegion>(World.UndergroundRegions); _selectProperties.ParentType = typeof(UndergroundRegion); break; case "Structures": _searchList = new SearchList <Structure>(World.Structures); _selectProperties.ParentType = typeof(Structure); break; case "Wars": _searchList = new SearchList <War>(World.Wars); _selectProperties.ParentType = typeof(War); break; case "Battles": _searchList = new SearchList <Battle>(World.Battles); _selectProperties.ParentType = typeof(Battle); break; case "Conquerings": _searchList = new SearchList <SiteConquered>(World.EventCollections.OfType <SiteConquered>().ToList()); _selectProperties.ParentType = typeof(SiteConquered); break; case "Rampages": _searchList = new SearchList <BeastAttack>(World.BeastAttacks); _selectProperties.ParentType = typeof(BeastAttack); break; case "Raids": _searchList = new SearchList <Raid>(World.EventCollections.OfType <Raid>().ToList()); _selectProperties.ParentType = typeof(Raid); break; case "Artifacts": _searchList = new SearchList <Artifact>(World.Artifacts); _selectProperties.ParentType = typeof(Artifact); break; case "Written Content": _searchList = new SearchList <WrittenContent>(World.WrittenContents); _selectProperties.ParentType = typeof(WrittenContent); break; } if (_selectProperties.ParentType == typeof(Site) || _selectProperties.ParentType == typeof(Battle)) { btnMapResults.Visible = true; } SelectionPanel.Clear(); SelectionPanel.CriteriaType = _searchList.GetMainListType(); SearchPanel.CriteriaType = _selectProperties.GetLowestPropertyType(); OrderByPanel.CriteriaType = _selectProperties.GetLowestPropertyType(); SelectSubListChanged(this, null); }