示例#1
0
        private void SelectSubListChanged(object sender, EventArgs e)
        {
            if (SelectProperties.SelectedIndex > 0)
            {
                SelectionPanel.Visible = true;
                if (SelectionPanel.Criteria.Count == 0)
                {
                    SelectionPanel.AddNew();
                }
            }
            else
            {
                SelectionPanel.Visible = false; SelectionPanel.Clear();
            }

            Type selectedType = SelectProperties.GetLowestPropertyType();

            if (selectedType.IsGenericType)
            {
                selectedType = selectedType.GetGenericArguments()[0];
            }

            SearchPanel.Clear();
            SearchPanel.CriteriaType = selectedType;
            SearchPanel.AddNew();

            OrderByPanel.Clear();
            OrderByPanel.CriteriaType = selectedType;
            OrderByPanel.AddNew();
            PanelResized(this, null);

            if (SelectProperties.SelectedIndex > 0)
            {
                if (selectedType == typeof(Site) || selectedType == typeof(Battle))
                {
                    btnMapResults.Visible = true;
                }
                else
                {
                    btnMapResults.Visible = false;
                }
            }
            else if (SelectProperties.ParentType == typeof(Site) || SelectProperties.ParentType == typeof(Battle))
            {
                btnMapResults.Visible = true;
            }
            else
            {
                btnMapResults.Visible = false;
            }

            //if (SelectProperties.SelectedIndex != 0)
            //    lblSearchCriteria.Text = "Search " + SelectProperties.Text + " Where:";
            //else
            //    lblSearchCriteria.Text = "Search " + SelectList.Text + " Where:";
        }
示例#2
0
 public Type GetLowestPropertyType()
 {
     if (SelectedProperty != null && Child == null)
     {
         return(SelectedProperty.Type);
     }
     if (SelectedProperty == null)
     {
         return(ParentType);
     }
     return(Child.GetLowestPropertyType());
 }
示例#3
0
        public void GetComparers()
        {
            if (OrderByCriteria)
            {
                if (PropertySelect.Child != null && PropertySelect.Child.SelectedProperty != null && PropertySelect.ContainsList() && !PropertySelect.ContainsListLast())
                {
                    ComparerSelect.SelectedIndexChanged += ComparerChanged;
                    Controls.AddRange(new Control[] { ComparerSelect, ValueSelect });
                    ValueSelect.Items.Clear();
                    ValueSelect.Text = "";
                }
                else
                {
                    ComparerSelect.SelectedIndexChanged += null;
                    Controls.Remove(ComparerSelect);
                    Controls.Remove(ValueSelect);
                }
            }
            ComparerSelect.Items.Clear();
            Type propertyType = PropertySelect.GetLowestPropertyType();
            List <QueryComparer> comparers = SearchProperty.GetComparers(propertyType);

            if (OrderByCriteria && PropertySelect.Child != null && (propertyType == typeof(int) || propertyType == typeof(double) || propertyType.IsGenericType))
            {
                comparers.AddRange(new List <QueryComparer>()
                {
                    QueryComparer.Min, QueryComparer.Max, QueryComparer.Average, QueryComparer.Sum
                });
            }

            ComparerSelect.Items.AddRange(comparers.Cast <object>().ToArray());
            //foreach (QueryComparer comparer in comparers)
            //    ComparerSelect.Items.Insert(SearchProperty.ComparerToString(comparer));
            if (comparers.Count > 0)
            {
                ComparerSelect.SelectedIndex = 0;
            }
        }
示例#4
0
        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:";
        }
示例#5
0
        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:";
        }
示例#6
0
        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);
        }