Skip to content

Commit

Permalink
added assets found label
Browse files Browse the repository at this point in the history
  • Loading branch information
kruumy authored and kruumy committed Mar 9, 2023
1 parent 900d928 commit d1d085f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
21 changes: 18 additions & 3 deletions EasyZoneBuilder.GUI/Zone.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="35"></RowDefinition>
<RowDefinition Height="35"></RowDefinition>
Expand All @@ -31,9 +32,23 @@
Loaded="selectedAssetType_Loaded">
</ComboBox>
</Grid>
<Grid Grid.Row="1" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label
x:Name="AssetsFoundLabel"
Content="Assets Found: 0"
HorizontalAlignment="Left"
FontSize="11"
Margin="2,0,0,0">
</Label>
</Grid>
<ListBox
x:Name="AssetList"
Grid.Row="1"
Grid.Row="2"
Margin="5">
<ListBox.ContextMenu>
<ContextMenu>
Expand All @@ -52,7 +67,7 @@
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
<Grid Grid.Row="2">
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
Expand All @@ -76,7 +91,7 @@
<Button
x:Name="readFastFileBtn"
Grid.Column="0"
Grid.Row="3"
Grid.Row="4"
Margin="5"
Content="Read From FastFile"
Click="readFastFileBtn_Click">
Expand Down
9 changes: 7 additions & 2 deletions EasyZoneBuilder.GUI/Zone.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using EasyZoneBuilder.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
Expand All @@ -21,15 +23,18 @@ private void selectedZone_Loaded( object sender, RoutedEventArgs e )
{
selectedZone.ItemsSource = Settings.IW4.Zones;
}
private CollectionViewSource cvs = new CollectionViewSource();
public readonly CollectionViewSource cvs = new CollectionViewSource();
private async void readFastFileBtn_Click( object sender, RoutedEventArgs e )
{
if ( selectedZone.SelectedItem is string ss && selectedAssetType.SelectedItem is string sat )
{
readFastFileBtn.IsEnabled = false;
AssetList.ItemsSource = Array.Empty<string>();
cvs.Source = await ZoneBuilder.ListAssets(AssetTypeUtil.Parse(sat), ss);
AssetsFoundLabel.Content = "Assets Found: 0";
IEnumerable<string> assets = await ZoneBuilder.ListAssets(AssetTypeUtil.Parse(sat), ss);
cvs.Source = assets;
AssetList.ItemsSource = cvs.View;
AssetsFoundLabel.Content = "Assets Found: " + assets.Count();
readFastFileBtn.IsEnabled = true;
}
}
Expand Down

0 comments on commit d1d085f

Please sign in to comment.