37 lines
809 B
C#
37 lines
809 B
C#
using MangaReader.WinUI.ViewModels;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.UI.Xaml;
|
|
using System;
|
|
|
|
namespace MangaReader.WinUI;
|
|
|
|
public partial class App : Application
|
|
{
|
|
private Window? _window;
|
|
|
|
public static IServiceProvider ServiceProvider { get; private set; }
|
|
|
|
static App()
|
|
{
|
|
ServiceCollection services = new();
|
|
|
|
services.AddSingleton<MainWindow>();
|
|
|
|
services.AddSingleton<SearchViewModel>();
|
|
|
|
services.AddMangaReader();
|
|
|
|
ServiceProvider = services.BuildServiceProvider();
|
|
}
|
|
|
|
public App()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
|
{
|
|
_window = ServiceProvider.GetRequiredService<MainWindow>();
|
|
_window.Activate();
|
|
}
|
|
} |