31 lines
829 B
C#
31 lines
829 B
C#
|
|
using Avalonia;
|
||
|
|
using Avalonia.Controls.ApplicationLifetimes;
|
||
|
|
using Avalonia.Markup.Xaml;
|
||
|
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
|
using Nebula.Shared;
|
||
|
|
|
||
|
|
namespace Nebula.UpdateResolver;
|
||
|
|
|
||
|
|
public partial class App : Application
|
||
|
|
{
|
||
|
|
public override void Initialize()
|
||
|
|
{
|
||
|
|
AvaloniaXamlLoader.Load(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void OnFrameworkInitializationCompleted()
|
||
|
|
{
|
||
|
|
var services = new ServiceCollection();
|
||
|
|
services.AddServices();
|
||
|
|
services.AddTransient<MainWindow>();
|
||
|
|
|
||
|
|
var serviceProvider = services.BuildServiceProvider();
|
||
|
|
|
||
|
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||
|
|
{
|
||
|
|
desktop.MainWindow = serviceProvider.GetService<MainWindow>();
|
||
|
|
}
|
||
|
|
|
||
|
|
base.OnFrameworkInitializationCompleted();
|
||
|
|
}
|
||
|
|
}
|