MessageBox revision and more async loading

This commit is contained in:
Michael Bucari-Tovo 2022-07-14 12:51:50 -06:00
parent a5d225dc44
commit 61a529e62b
10 changed files with 141 additions and 103 deletions

View file

@ -8,6 +8,7 @@ using Avalonia.Threading;
using LibationWinForms.AvaloniaUI.Views.ProductsGrid;
using Avalonia.ReactiveUI;
using LibationWinForms.AvaloniaUI.ViewModels;
using System.Threading.Tasks;
namespace LibationWinForms.AvaloniaUI.Views
{
@ -21,7 +22,6 @@ namespace LibationWinForms.AvaloniaUI.Views
#endif
this.FindAllControls();
// eg: if one of these init'd productsGrid, then another can't reliably subscribe to it
Configure_BackupCounts();
Configure_ScanAuto();
@ -38,11 +38,21 @@ namespace LibationWinForms.AvaloniaUI.Views
// misc which belongs in winforms app but doesn't have a UI element
Configure_NonUI();
async void DoDisplay(object _, EventArgs __)
{
this.Load += (_, _) => productsDisplay.Display();
LibraryCommands.LibrarySizeChanged += (_, __) => Dispatcher.UIThread.Post(() => productsDisplay.Display());
await productsDisplay.Display();
}
{
this.Load += DoDisplay;
LibraryCommands.LibrarySizeChanged += DoDisplay;
}
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public event EventHandler Load;
public void OnLoad() => Load?.Invoke(this, EventArgs.Empty);
@ -114,10 +124,5 @@ namespace LibationWinForms.AvaloniaUI.Views
{
base.OnDataContextChanged(e);
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}