Exemplo n.º 1
0
        private void OnFilterComboDER(StackPanel stackPanel)
        {
            OnFilterRadioButtonDER(stackPanel);

            IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Type != FilterDER.Type)).ToList();

            foreach (DER user in usersToRemove)
            {
                DERs.Remove(user);
            }

            string      temp    = FilterDER.Type.ToString() + " sa Id-em ";
            RadioButton greater = (RadioButton)stackPanel.Children[3];
            RadioButton less    = (RadioButton)stackPanel.Children[4];

            if (greater.IsChecked == true)
            {
                temp = temp + "većim od " + filterDER.Id;
            }
            if (less.IsChecked == true)
            {
                temp = temp + "manjim od " + filterDER.Id;
            }

            if (comboBoxComboItems.FirstOrDefault(x => x == temp) == null)
            {
                comboBoxComboItems.Add(temp);
            }
        }
Exemplo n.º 2
0
        private void OnFilterRadioButtonDER(StackPanel stackPanel)
        {
            fillList();

            RadioButton greater = (RadioButton)stackPanel.Children[3];
            RadioButton less    = (RadioButton)stackPanel.Children[4];

            if (greater.IsChecked == true)
            {
                IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id < filterDER.Id)).ToList();

                foreach (var item in usersToRemove)
                {
                    DERs.Remove(item);
                }
                if (comboBoxRadioButtonItems.FirstOrDefault(x => x == "Veće od " + filterDER.Id) == null)
                {
                    comboBoxRadioButtonItems.Add("Veće od " + filterDER.Id);
                }
            }

            if (less.IsChecked == true)
            {
                IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id > filterDER.Id)).ToList();

                foreach (var item in usersToRemove)
                {
                    DERs.Remove(item);
                }
                if (comboBoxRadioButtonItems.FirstOrDefault(x => x == "Manje od " + filterDER.Id) == null)
                {
                    comboBoxRadioButtonItems.Add("Manje od " + filterDER.Id);
                }
            }
        }
Exemplo n.º 3
0
        private void OnSelectedItemChangedComboBox1(string selection)
        {
            fillList();

            char filterType  = selection[0];
            int  filterValue = int.Parse(selection.Split(' ')[2]);

            if (filterType == 'V')
            {
                IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id < filterValue)).ToList();

                foreach (var item in usersToRemove)
                {
                    DERs.Remove(item);
                }
            }

            if (filterType == 'M')
            {
                IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id > filterValue)).ToList();

                foreach (var item in usersToRemove)
                {
                    DERs.Remove(item);
                }
            }
        }
Exemplo n.º 4
0
        private void OnFilterComboBox()
        {
            fillList();

            IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Type != FilterDER.Type)).ToList();

            foreach (DER user in usersToRemove)
            {
                DERs.Remove(user);
            }
        }
Exemplo n.º 5
0
        private void OnSelectedItemChangedComboBox2(string selection)
        {
            fillList();


            string filterType  = selection.Split(' ')[0];
            char   filterValue = selection[selection.Length - 8];
            int    filterId    = int.Parse(selection.Split(' ')[5]);

            if (filterType == "Solarni_Panel")
            {
                IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Type != GeneratorType.Solarni_Panel)).ToList();

                foreach (DER user in usersToRemove)
                {
                    DERs.Remove(user);
                }
            }
            else if (filterType == "Vetrogenerator")
            {
                IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Type != GeneratorType.Vetrogenerator)).ToList();

                foreach (DER user in usersToRemove)
                {
                    DERs.Remove(user);
                }
            }
            if (filterId >= 10)
            {
                filterValue = selection[selection.Length - 9];

                if (filterValue == 'ć')
                {
                    IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id <= filterId)).ToList();

                    foreach (var item in usersToRemove)
                    {
                        DERs.Remove(item);
                    }
                }
                else if (filterValue == 'j')
                {
                    IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id >= filterId)).ToList();

                    foreach (var item in usersToRemove)
                    {
                        DERs.Remove(item);
                    }
                }
            }
            else
            {
                if (filterValue == 'ć')
                {
                    IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id <= filterId)).ToList();

                    foreach (var item in usersToRemove)
                    {
                        DERs.Remove(item);
                    }
                }
                else if (filterValue == 'j')
                {
                    IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Id >= filterId)).ToList();

                    foreach (var item in usersToRemove)
                    {
                        DERs.Remove(item);
                    }
                }
            }
        }