Skip to content

Commit

Permalink
Store last selected search list and load list when add species dialog…
Browse files Browse the repository at this point in the history
… opens
  • Loading branch information
jamckee authored and Rottenbeer committed Aug 4, 2019
1 parent 3ad1342 commit 121d72d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
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 @@
Visibility="{Binding CreateSearchAvailable, Converter={StaticResource BoolToVisibilityConverter}}"/>
<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="groupsCombo" Text="{Binding Group}" IsEditable="True" />
<ComboBox x:Name="speciesCombo" Text="{Binding Species}" IsEditable="True" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="4">
<TextBlock Text="Min"/>
Expand Down
4 changes: 4 additions & 0 deletions LarkatorGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ private void CreateSearch_Click(object sender, RoutedEventArgs e)

speciesCombo.ItemsSource = arkReader.AllSpecies;
groupsCombo.ItemsSource = ListSearches.Select(sc => sc.Group).Distinct().OrderBy(g => g).ToArray();
int temp = Properties.Settings.Default.lastGroup;
groupsCombo.SelectedIndex = Properties.Settings.Default.lastGroup;
}

private void Dev_Calibration_Click(object sender, MouseButtonEventArgs e)
Expand Down Expand Up @@ -529,6 +531,8 @@ private void SaveSearch_Click(object sender, RoutedEventArgs e)
List<String> NewSearchList;
SearchCriteria tempSearch;
if (String.IsNullOrWhiteSpace(NewSearch.Species)) return;
Properties.Settings.Default.lastGroup = groupsCombo.SelectedIndex;
Properties.Settings.Default.Save();
NewSearchList = new List<String>(AllSpecies.Where(species => species.Contains(NewSearch.Species)));
if (NewSearchList.Count == 0) // No matches
{ //Trigger default values so the user knows we tried to match
Expand Down
12 changes: 12 additions & 0 deletions LarkatorGUI/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions LarkatorGUI/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@
<Setting Name="showOxygen" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="lastGroup" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
3 changes: 3 additions & 0 deletions LarkatorGUI/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<setting name="showOxygen" serializeAs="String">
<value>False</value>
</setting>
<setting name="lastGroup" serializeAs="String">
<value>0</value>
</setting>
</LarkatorGUI.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 121d72d

Please sign in to comment.