Add another example app

This commit is contained in:
Daniel Clark
2022-11-03 12:33:23 +00:00
parent 854d393b43
commit c601957dd9
38 changed files with 1070 additions and 30 deletions
+27
View File
@@ -0,0 +1,27 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using TheXamlGuy.Framework.Core;
namespace KingPing;
public class StartedHandler : IMediatorHandler<Started>
{
private readonly MainWindow window;
private readonly MainWindowViewModel viewModel;
public StartedHandler(MainWindow window,
MainWindowViewModel viewModel)
{
this.window = window;
this.viewModel = viewModel;
}
public void Handle(Started request)
{
window.DataContext = viewModel;
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = window;
}
}
}