Exemplo n.º 1
0
 public void Remove()
 {
     if (Child != null)
     {
         PropertyBox temp = Child;
         Child = null;
         temp.Remove();
     }
     Parent.Controls.Remove(this);
 }
Exemplo n.º 2
0
        protected override void OnSelectedIndexChanged(EventArgs e)
        {
            Graphics g = CreateGraphics();

            Width = (int)g.MeasureString(Text, Font).Width + 20;
            g.Dispose();

            if (!SelectedItem.Equals(""))
            {
                SelectedProperty = SelectedItem as SearchProperty;
            }
            else
            {
                SelectedProperty = null;
            }

            if (Child != null)
            {
                PropertyBox temp = Child;
                Child = null;
                temp.Remove();
            }

            //if listproperties only and subproperties contains other lists or !list
            if (!ListPropertiesOnly && SelectedProperty != null && (!ListPropertiesOnly && SelectedProperty.SubProperties.Any() || ListPropertiesOnly && SelectedProperty.SubProperties.Count(property => property.SubProperties.Count > 0) > 0))
            {
                Child = new PropertyBox
                {
                    _parentProperty    = this,
                    ParentType         = (SelectedItem as SearchProperty).Type,
                    ListPropertiesOnly = ListPropertiesOnly,
                    Location           = new Point(Right + 0, Top)
                };
                Parent.Controls.Add(Child);
            }
            if (Parent.GetType() == typeof(CriteriaLine))
            {
                (Parent as CriteriaLine).GetComparers();
                (Parent as CriteriaLine).ValueSelect.ResetText();
                (Parent as CriteriaLine).GetValueOptions();
                (Parent as CriteriaLine).ResizeSelf();
            }

            base.OnSelectedIndexChanged(e);
        }
Exemplo n.º 3
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:";
        }
Exemplo n.º 4
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);
        }