1
0
Fork 0
mirror of https://github.com/oMaN-Rod/nxDumpFuse.git synced 2024-12-08 01:32:07 +00:00
nxDumpFuse/src/nxDumpFuse/App.axaml.cs
2021-11-02 08:19:59 -04:00

38 lines
1.1 KiB
C#

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using nxDumpFuse.Extensions;
using nxDumpFuse.ViewModels;
using nxDumpFuse.ViewModels.Interfaces;
using nxDumpFuse.Views;
using Splat;
namespace nxDumpFuse
{
public class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
DataContext = GetRequiredService<IMainWindowViewModel>();
desktop.MainWindow = new MainWindow
{
DataContext = DataContext
};
}
var theme = new Avalonia.Themes.Default.DefaultTheme();
theme.TryGetResource("Button", out _);
base.OnFrameworkInitializationCompleted();
}
private static T GetRequiredService<T>() => Locator.Current.GetRequiredService<T>();
}
}