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); } }
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); } } }
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); } } }
private void OnFilterComboBox() { fillList(); IReadOnlyList <DER> usersToRemove = DERs.Where(x => (x.Type != FilterDER.Type)).ToList(); foreach (DER user in usersToRemove) { DERs.Remove(user); } }
private void OnDelete() { DERs.Remove(DERs.FirstOrDefault(x => x.Id == RemoveDER.Id)); foreach (var item in savedDERs.ToList()) { if (DERs.FirstOrDefault(x => x.Id == item.Id) == null) { savedDERs.Remove(item); } } }
public void fillList() { if (savedDERs.Count != 0) { foreach (var item in savedDERs.ToList()) { if (DERs.FirstOrDefault(x => x.Id == item.Id) == null) { DERs.Add(item); } } } //DERs = savedDERs; }
private void OnAdd() { for (int i = 0; i < 12; i++) { CurrentDER.Id = i; if (DERs.FirstOrDefault(x => x.Id == currentDER.Id) == null) { DERs.Add(new DER() { Id = CurrentDER.Id, Name = "Temporary name.", Type = CurrentDER.Type, EnergyValue = "Privremena energetska vrednost." }); savedDERs.Add(new DER() { Id = CurrentDER.Id, Name = "Temporary name.", Type = CurrentDER.Type, EnergyValue = "Privremena energetska vrednost." }); return; } } }
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); } } } }