Added UI app.
This commit is contained in:
37
MangaReader.WinUI/App.xaml.cs
Normal file
37
MangaReader.WinUI/App.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user