Exemplo n.º 1
0
        private void Redraw()
        {
            foreach (var item in Filters)
            {
                container.Controls.Remove(item.Data);
                container.Controls.Remove(item.RemoveButton);
                container.Controls.Remove(item.Label);
            }
            container.Controls.Remove(Cap);
            FillCap();
            int offsetTop    = 15;
            int offsetLeft   = 10;
            int additionLeft = 5;

            TrimComboBox(Cap);
            foreach (var item in Filters)
            {
                TrimComboBox(item.Data);
                TrimButton(item.RemoveButton);
                var buf = offsetLeft;
                ToDrawControlParameters(item.Label, offsetTop, ref offsetLeft, additionLeft);
                offsetLeft = buf;
                ToDrawControlParameters(item.Data, offsetTop + 15, ref offsetLeft, additionLeft);
                ToDrawControlParameters(item.RemoveButton, offsetTop + 15, ref offsetLeft, additionLeft);
                item.RemoveButton.Click += (object sender, EventArgs e) => DeleteFilter(item);
                container.Controls.Add(item.Data);
                container.Controls.Add(item.RemoveButton);
                container.Controls.Add(item.Label);
            }
            ToDrawControlParameters(Cap, offsetTop + 5, ref offsetLeft, additionLeft);
            container.Controls.Add(Cap);
            Cap.SelectedIndexChanged += OnChoiceNewFilter;

            OnChangeFilter?.Invoke(this, new FilteredDataEventArgs(GetFiltered()));
        }
Exemplo n.º 2
0
        public FilterCollection(Control container, IEnumerable <object> data)
        {
            Filters = new List <Filter>();

            this.container = container;
            Data           = data;
            FillCap();
            Redraw();

            OnChangeFilter?.Invoke(this, new FilteredDataEventArgs(Data));
        }
Exemplo n.º 3
0
        private void LabelLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var link = sender as LinkLabel;

            OnChangeFilter?.Invoke(ModList.FilterToSavedSearch(GUIModFilter.CustomLabel, null, link.Tag as ModuleLabel));
        }
Exemplo n.º 4
0
 private void OnChangeFilteringConfiguration(object sender, EventArgs e)
 {
     OnChangeFilter?.Invoke(this, new FilteredDataEventArgs(GetFiltered()));
 }