Skip to content

Commit

Permalink
speeded up filtering a bunch
Browse files Browse the repository at this point in the history
  • Loading branch information
kruumy committed Mar 12, 2023
1 parent 71855d5 commit ddf2ff2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions EasyZoneBuilder.GUI/NewZone.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
Expand Down Expand Up @@ -66,11 +67,19 @@ private async void ReadZoneBtn_Click( object sender, RoutedEventArgs e )
ReadZoneBtn.IsEnabled = false;
object oldBtnContext = ReadZoneBtn.Content;
ReadZoneBtn.Content = "Reading...";
await RefreshAssetGrid();
ReadZoneBtn.Content = oldBtnContext;
ReadZoneBtn.IsEnabled = true;
}
}

private async Task RefreshAssetGrid()
{
if ( SelectZoneComboBox.SelectedItem is string ss )
{
AssetGrid.ItemsSource = Array.Empty<string>();
cvs.Source = await DependencyGraph.DefaultInstance.GetAssetsAsync(ss);
AssetGrid.ItemsSource = cvs.View;
ReadZoneBtn.Content = oldBtnContext;
ReadZoneBtn.IsEnabled = true;
}
}

Expand Down Expand Up @@ -104,7 +113,8 @@ private async void SearchBtn_Click( object sender, RoutedEventArgs e )
SearchBtn.IsEnabled = false;
object oldContent = SearchBtn.Content;
SearchBtn.Content = "Filtering...";
await cvs.Dispatcher.InvokeAsync(() => cvs.View.Refresh(), System.Windows.Threading.DispatcherPriority.Input);
await RefreshAssetGrid();
//await cvs.Dispatcher.InvokeAsync(() => cvs.View.Refresh(), System.Windows.Threading.DispatcherPriority.Input);
SearchBtn.Content = oldContent;
SearchBtn.IsEnabled = true;
SearchTextBox.IsEnabled = true;
Expand Down

0 comments on commit ddf2ff2

Please sign in to comment.