Skip to content

Commit

Permalink
Removed adjustcolumns function and switched to binding, corrected for…
Browse files Browse the repository at this point in the history
…matting in app.config, fixed label for food and oxygen
  • Loading branch information
jamckee authored and Rottenbeer committed Aug 4, 2019
1 parent 1fc78b0 commit 06ea22b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 30 deletions.
14 changes: 7 additions & 7 deletions LarkatorGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,13 @@
</DataGridTemplateColumn>
<DataGridTextColumn Header="Lvl" Width="1.2*" Binding="{Binding Dino.BaseLevel}"/>
<DataGridTextColumn Header="Pos" Width="2.2*" Binding="{Binding Path=Dino.Location, Converter={StaticResource PositionToStringConverter}}"/>
<DataGridTextColumn x:Name="health" Header="Hp" Width="1*" Binding="{Binding Path=Dino.WildLevels.Health}"/>
<DataGridTextColumn x:Name="stamina" Header="St" Width="1*" Binding="{Binding Path=Dino.WildLevels.Stamina}"/>
<DataGridTextColumn x:Name="weight" Header="Fd" Width="1*" Binding="{Binding Path=Dino.WildLevels.Weight}"/>
<DataGridTextColumn x:Name="melee" Header="Ox" Width="1*" Binding="{Binding Path=Dino.WildLevels.Melee}"/>
<DataGridTextColumn x:Name="speed" Header="We" Width="1*" Binding="{Binding Path=Dino.WildLevels.Speed}"/>
<DataGridTextColumn x:Name="food" Header="Me" Width="1*" Binding="{Binding Path=Dino.WildLevels.Food}"/>
<DataGridTextColumn x:Name="oxygen" Header="Sp" Width="1*" Binding="{Binding Path=Dino.WildLevels.Oxygen}"/>
<DataGridTextColumn x:Name="health" Header="Hp" Visibility="{Binding Source={StaticResource Settings}, Path=Default.ShowHealth, Converter={StaticResource BoolToVisibilityConverter}}" Width="1*" Binding="{Binding Path=Dino.WildLevels.Health}"/>
<DataGridTextColumn x:Name="stamina" Header="St" Visibility="{Binding Source={StaticResource Settings}, Path=Default.ShowStam, Converter={StaticResource BoolToVisibilityConverter}}" Width="1*" Binding="{Binding Path=Dino.WildLevels.Stamina}"/>
<DataGridTextColumn x:Name="oxygen" Header="Ox" Visibility="{Binding Source={StaticResource Settings}, Path=Default.ShowOxygen, Converter={StaticResource BoolToVisibilityConverter}}" Width="1*" Binding="{Binding Path=Dino.WildLevels.Weight}"/>
<DataGridTextColumn x:Name="food" Header="Fd" Visibility="{Binding Source={StaticResource Settings}, Path=Default.ShowFood, Converter={StaticResource BoolToVisibilityConverter}}" Width="1*" Binding="{Binding Path=Dino.WildLevels.Melee}"/>
<DataGridTextColumn x:Name="weight" Header="We" Visibility="{Binding Source={StaticResource Settings}, Path=Default.ShowWeight, Converter={StaticResource BoolToVisibilityConverter}}" Width="1*" Binding="{Binding Path=Dino.WildLevels.Speed}"/>
<DataGridTextColumn x:Name="melee" Header="Me" Visibility="{Binding Source={StaticResource Settings}, Path=Default.ShowMelee, Converter={StaticResource BoolToVisibilityConverter}}" Width="1*" Binding="{Binding Path=Dino.WildLevels.Food}"/>
<DataGridTextColumn x:Name="speed" Header="Sp" Visibility="{Binding Source={StaticResource Settings}, Path=Default.ShowSpeed, Converter={StaticResource BoolToVisibilityConverter}}" Width="1*" Binding="{Binding Path=Dino.WildLevels.Oxygen}"/>
</DataGrid.Columns>
</DataGrid>

Expand Down
17 changes: 0 additions & 17 deletions LarkatorGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ public MainWindow()
}, DispatcherPriority.Loaded);

LoadSavedSearches();
adjustSearchColumns();
SetupFileWatcher();

var cmdThrowExceptionAndExit = new RoutedCommand();
Expand Down Expand Up @@ -775,28 +774,13 @@ private void UpdateSearchResults(IList<SearchCriteria> searches)
ResultTotalCount = ShowTames ? sourceDinos.Sum(species => species.Value.Count()) : total;
ResultMatchingCount = ListResults.Count;

adjustSearchColumns();

}

((CollectionViewSource)Resources["OrderedResults"]).View.Refresh();

TriggerNameSearch(true);
}

private void AdjustSearchColumns()
{
resultsList.Columns[3].Visibility = Properties.Settings.Default.ShowHealth ? Visibility.Visible : Visibility.Collapsed;
resultsList.Columns[4].Visibility = Properties.Settings.Default.ShowStam ? Visibility.Visible : Visibility.Collapsed;
resultsList.Columns[5].Visibility = Properties.Settings.Default.ShowOxygen ? Visibility.Visible : Visibility.Collapsed;
resultsList.Columns[6].Visibility = Properties.Settings.Default.ShowFood ? Visibility.Visible : Visibility.Collapsed;
resultsList.Columns[7].Visibility = Properties.Settings.Default.ShowWeight ? Visibility.Visible : Visibility.Collapsed;
resultsList.Columns[8].Visibility = Properties.Settings.Default.ShowMelee ? Visibility.Visible : Visibility.Collapsed;
resultsList.Columns[9].Visibility = Properties.Settings.Default.ShowSpeed ? Visibility.Visible : Visibility.Collapsed;


}

private async Task PerformConversion()
{
string arkDirName = Path.GetFileNameWithoutExtension(Properties.Settings.Default.SaveFile);
Expand Down Expand Up @@ -920,7 +904,6 @@ private void OnSettingsChanged()
UpdateCurrentSearch();

ForceFontSizeUpdate();
adjustSearchColumns();
reloadTimer.Interval = TimeSpan.FromMilliseconds(Properties.Settings.Default.ConvertDelay);
}

Expand Down
12 changes: 6 additions & 6 deletions LarkatorGUI/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
<setting name="ShowStam" serializeAs="String">
<value>True</value>
</setting>
<setting name="ShowOxygen" serializeAs="String">
<value>False</value>
</setting>
<setting name="ShowFood" serializeAs="String">
<value>False</value>
</setting>
<setting name="ShowOxygen" serializeAs="String">
<value>False</value>
</setting>
<setting name="ShowFood" serializeAs="String">
<value>False</value>
</setting>
<setting name="ShowWeight" serializeAs="String">
<value>True</value>
</setting>
Expand Down

0 comments on commit 06ea22b

Please sign in to comment.