Skip to content

Commit

Permalink
Switched LastGroup to a String variable and fixed implementation with…
Browse files Browse the repository at this point in the history
… a try/catch block to default back to Shopping List if variable is lost
  • Loading branch information
jamckee authored and Rottenbeer committed Aug 4, 2019
1 parent c137fb7 commit 74cac98
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion LarkatorGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,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" />
<ComboBox x:Name="speciesCombo" Text="{Binding Species}" IsEditable="True" />
<ComboBox x:Name="speciesCombo" Text="{Binding Species}" IsEditable="True" StaysOpenOnEdit="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
12 changes: 10 additions & 2 deletions LarkatorGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ private void CreateSearch_Click(object sender, RoutedEventArgs e)

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

private void Dev_Calibration_Click(object sender, MouseButtonEventArgs e)
Expand Down Expand Up @@ -532,7 +532,15 @@ private void SaveSearch_Click(object sender, RoutedEventArgs e)
SearchCriteria tempSearch;
int order = 100;

Properties.Settings.Default.LastGroup = groupsCombo.SelectedIndex;
//If we lose our selection default back to Shopping List
try
{
Properties.Settings.Default.LastGroup = groupsCombo.Text;
}
catch
{
Properties.Settings.Default.LastGroup = "Shopping List";
}
Properties.Settings.Default.Save();


Expand Down
8 changes: 4 additions & 4 deletions LarkatorGUI/Properties/Settings.Designer.cs

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

4 changes: 2 additions & 2 deletions LarkatorGUI/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<Setting Name="ShowSpeed" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="LastGroup" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
<Setting Name="LastGroup" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="HideUntameable" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
Expand Down
2 changes: 1 addition & 1 deletion LarkatorGUI/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<value>True</value>
</setting>
<setting name="LastGroup" serializeAs="String">
<value>0</value>
<value />
</setting>
<setting name="HideUntameable" serializeAs="String">
<value>False</value>
Expand Down

0 comments on commit 74cac98

Please sign in to comment.