private void filterOptionsButton_Click(object sender, RoutedEventArgs e) { //TODO preventing multiple Windows FilterOptionsWindow filterWindow = new FilterOptionsWindow(); FilterOptionsWindow.fillFilterBox(filterWindow); filterWindow.Show(); }
/// <summary> /// gives back the selected Value from the filterbox /// </summary> /// <param name="filterWindow"></param> /// <returns></returns> public static string giveBackFilterBox(FilterOptionsWindow filterWindow) { ListBoxItem X = (ListBoxItem)filterWindow.filterBox.SelectedValue; if (X != null) { return(X.Content.ToString()); } else { return(""); } }
/// <summary> /// Collects all mods you found, to show them in your filter /// </summary> /// <param name="filterWindow"></param> public static void fillFilterBox(FilterOptionsWindow filterWindow) { Stashes.getAbsolutelyAllMods(); filterWindow.filterBox.Items.Clear(); foreach (string mod in Stashes.absolutelyAllMods) { if (filterWindow.searchFilterTxtBox.Text == "" || mod.ToLower().Contains(filterWindow.searchFilterTxtBox.Text.ToLower())) { ListBoxItem item = new ListBoxItem(); item.Content = mod; filterWindow.filterBox.Items.Add(item); } } }