Skip to content

Commit

Permalink
Added wildcard search to add multiple dinos
Browse files Browse the repository at this point in the history
  • Loading branch information
jamckee authored and Rottenbeer committed Aug 4, 2019
1 parent 13fd869 commit 80cd47c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LarkatorGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
<Grid Margin="16,0,16,16" Visibility="{Binding NewSearchActive, Converter={StaticResource BoolToVisibilityConverter}}" Background="#44ffffff">
<StackPanel Margin="8" Orientation="Vertical" HorizontalAlignment="Stretch" DataContext="{Binding NewSearch}">
<ComboBox x:Name="groupsCombo" Text="{Binding Group}" IsEditable="True" SelectedIndex="0"/>
<ComboBox x:Name="speciesCombo" Text="{Binding Species}"/>
<ComboBox x:Name="speciesCombo" Text="{Binding Species}" IsEditable="True"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="4">
<TextBlock Text="Min"/>
<TextBlock Text="{Binding MinLevel, ConverterParameter=-, Converter={StaticResource OptionalIntConverter}}" MinWidth="64" MouseWheel="AdjustableInteger_MouseWheel"/>
Expand Down
13 changes: 12 additions & 1 deletion LarkatorGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,11 @@ private void Dev_DummyData_Click(object sender, MouseButtonEventArgs e)

private void SaveSearch_Click(object sender, RoutedEventArgs e)
{
List<String> NewSearchList;
SearchCriteria tempSearch;
if (String.IsNullOrWhiteSpace(NewSearch.Species)) return;
NewSearchList = new List<String>(AllSpecies.Where(species => species.Contains(NewSearch.Species)));
if (NewSearchList.Count == 0) return; // No matches

try
{
Expand All @@ -534,8 +538,15 @@ private void SaveSearch_Click(object sender, RoutedEventArgs e)
catch (InvalidOperationException) // no entries for .Max - ignore
{ }

ListSearches.Add(NewSearch);
foreach (String newDino in NewSearchList)
{
tempSearch = new SearchCriteria(NewSearch);
tempSearch.Species = newDino;
ListSearches.Add(tempSearch);
}

NewSearch = null;
tempSearch = null;
NewSearchActive = false;
CreateSearchAvailable = true;

Expand Down

0 comments on commit 80cd47c

Please sign in to comment.