Example #1
0
        private ComboBoxFilter CreateComboBoxFilter(string name, Color color)
        {
            SortableBindingList <string> allAdditionalFieldValues = new SortableBindingList <string>();
            ComboBoxFilter additionalFieldFilter = new ComboBoxFilter();

            additionalFieldFilter.label.Text = name;
            additionalFieldFilter.Dock       = DockStyle.Top;
            additionalFieldFilter.Height     = 45;
            additionalFieldFilter.TaskColor  = color;
            additionalFieldFilter.BackColor  = color;
            additionalFieldFilter.ComboBox.SelectedValueChanged += FilterComboBoxValueChanged;
            panelColumnAvailableFilter.Controls.Add(additionalFieldFilter);
            return(additionalFieldFilter);
        }
Example #2
0
        private void AddStandardFilters()
        {
            TextBoxFilter filterShortDescription = CreateTextBoxFilter("Short Description", BlackTheme.ColorDarkGray2);

            ComboBoxFilter filterStatus = CreateComboBoxFilter("Status", BlackTheme.ColorDarkGray2);

            filterStatus.ComboBox.DataSource = Enum.GetValues(typeof(Status));

            ComboBoxFilter filterSprint = CreateComboBoxFilter("Sprint", BlackTheme.ColorDarkGray2);

            filterSprint.ComboBox.DataSource    = sprintBindingSource;
            filterSprint.ComboBox.DisplayMember = "Summary";

            ComboBoxFilter filterProject = CreateComboBoxFilter("Project", BlackTheme.ColorDarkGray2);

            filterProject.ComboBox.DataSource    = projectBindingSource;
            filterProject.ComboBox.DisplayMember = "ShortDescription";
        }
Example #3
0
        private void AddAdditionalFieldsFilters()
        {
            AdditionalField1.HeaderText = Settings.Default.AdditionaField1Name;
            AdditionalField2.HeaderText = Settings.Default.AdditionaField2Name;
            AdditionalField3.HeaderText = Settings.Default.AdditionaField3Name;
            AdditionalField4.HeaderText = Settings.Default.AdditionaField4Name;
            AdditionalField5.HeaderText = Settings.Default.AdditionaField5Name;

            ComboBoxFilter additionalField1Filter = CreateComboBoxFilter(Settings.Default.AdditionaField1Name, BlackTheme.ColorDarkGray2);
            ComboBoxFilter additionalField2Filter = CreateComboBoxFilter(Settings.Default.AdditionaField2Name, BlackTheme.ColorDarkGray2);
            ComboBoxFilter additionalField3Filter = CreateComboBoxFilter(Settings.Default.AdditionaField3Name, BlackTheme.ColorDarkGray2);
            ComboBoxFilter additionalField4Filter = CreateComboBoxFilter(Settings.Default.AdditionaField4Name, BlackTheme.ColorDarkGray2);
            ComboBoxFilter additionalField5Filter = CreateComboBoxFilter(Settings.Default.AdditionaField5Name, BlackTheme.ColorDarkGray2);

            SortableBindingList <string> allAdditionalField1Values = new SortableBindingList <string>();
            SortableBindingList <string> allAdditionalField2Values = new SortableBindingList <string>();
            SortableBindingList <string> allAdditionalField3Values = new SortableBindingList <string>();
            SortableBindingList <string> allAdditionalField4Values = new SortableBindingList <string>();
            SortableBindingList <string> allAdditionalField5Values = new SortableBindingList <string>();
            SortableBindingList <Todo>   allTodos = (SortableBindingList <Todo>)todoBindingSource.DataSource;

            foreach (Todo todo in allTodos)
            {
                if (!allAdditionalField1Values.Contains(todo.AdditionalField1))
                {
                    if (todo.AdditionalField1 != null)
                    {
                        allAdditionalField1Values.Add(todo.AdditionalField1);
                    }
                }
                if (!allAdditionalField2Values.Contains(todo.AdditionalField2))
                {
                    if (todo.AdditionalField2 != null)
                    {
                        allAdditionalField2Values.Add(todo.AdditionalField2);
                    }
                }
                if (!allAdditionalField3Values.Contains(todo.AdditionalField3))
                {
                    if (todo.AdditionalField3 != null)
                    {
                        allAdditionalField3Values.Add(todo.AdditionalField3);
                    }
                }
                if (!allAdditionalField4Values.Contains(todo.AdditionalField4))
                {
                    if (todo.AdditionalField4 != null)
                    {
                        allAdditionalField4Values.Add(todo.AdditionalField4);
                    }
                }
                if (!allAdditionalField5Values.Contains(todo.AdditionalField5))
                {
                    if (todo.AdditionalField5 != null)
                    {
                        allAdditionalField5Values.Add(todo.AdditionalField5);
                    }
                }
            }
            additionalField1Filter.ComboBox.DataSource = allAdditionalField1Values;
            additionalField2Filter.ComboBox.DataSource = allAdditionalField2Values;
            additionalField3Filter.ComboBox.DataSource = allAdditionalField3Values;
            additionalField4Filter.ComboBox.DataSource = allAdditionalField4Values;
            additionalField5Filter.ComboBox.DataSource = allAdditionalField5Values;
        }
Example #4
0
        private void ReloadTaskGrid()
        {
            SortableBindingList <Todo> filteredList = new SortableBindingList <Todo>();

            try
            {
                filteredList = (SortableBindingList <Todo>)TodoBindingSource.DataSource;
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
            foreach (Control filter in panelColumn1.Controls)
            {
                if (filter is ComboBoxFilter)
                {
                    ComboBoxFilter comboBoxFilter = (ComboBoxFilter)filter;
                    if (comboBoxFilter.ComboBox.SelectedItem != null && filteredList != null)
                    {
                        if (comboBoxFilter.ComboBox.SelectedItem is Sprint)
                        {
                            filteredList = SprintFilter(filteredList, (Sprint)comboBoxFilter.ComboBox.SelectedItem);
                        }
                        else if (comboBoxFilter.ComboBox.SelectedItem is Project)
                        {
                            filteredList = ProjectFilter(filteredList, (Project)comboBoxFilter.ComboBox.SelectedItem);
                        }
                        else if (comboBoxFilter.ComboBox.SelectedValue is Status)
                        {
                            filteredList = ProjectStatusFilter(filteredList, (Status)comboBoxFilter.ComboBox.SelectedItem);
                        }
                        else if (comboBoxFilter.ComboBox.SelectedValue is string)
                        {
                            if (comboBoxFilter.label.Text == Settings.Default.AdditionaField1Name)
                            {
                                filteredList = AdditionalField1Filter(filteredList, (string)comboBoxFilter.ComboBox.SelectedValue);
                            }
                            else if (comboBoxFilter.label.Text == Settings.Default.AdditionaField2Name)
                            {
                                filteredList = AdditionalField2Filter(filteredList, (string)comboBoxFilter.ComboBox.SelectedValue);
                            }
                            else if (comboBoxFilter.label.Text == Settings.Default.AdditionaField3Name)
                            {
                                filteredList = AdditionalField3Filter(filteredList, (string)comboBoxFilter.ComboBox.SelectedValue);
                            }
                            else if (comboBoxFilter.label.Text == Settings.Default.AdditionaField4Name)
                            {
                                filteredList = AdditionalField4Filter(filteredList, (string)comboBoxFilter.ComboBox.SelectedValue);
                            }
                            else if (comboBoxFilter.label.Text == Settings.Default.AdditionaField5Name)
                            {
                                filteredList = AdditionalField5Filter(filteredList, (string)comboBoxFilter.ComboBox.SelectedValue);
                            }
                            else
                            {
                                throw new Exception(string.Format("Unknown Filter Type: '{0}'", comboBoxFilter.label.Text));
                            }
                        }
                    }
                }
                else if (filter is TextBoxFilter && filteredList != null)
                {
                    filteredList = ProjectShortDescriptionFilter(filteredList, ((TextBoxFilter)filter).TextBox.Text);
                }
            }
            if (filteredList != null)
            {
                dataGridViewTodos.DataSource = filteredList;
            }
        }