46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using Harmonia.Core.Extensions;
|
|
using Harmonia.WinUI.Caching;
|
|
using Harmonia.WinUI.Storage;
|
|
using Harmonia.WinUI.ViewModels;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.UI.Xaml;
|
|
using System;
|
|
|
|
namespace Harmonia.WinUI;
|
|
|
|
public partial class App : Application
|
|
{
|
|
private Window? _mainWindow;
|
|
|
|
public static IServiceProvider ServiceProvider { get; private set; }
|
|
|
|
static App()
|
|
{
|
|
ServiceCollection services = new();
|
|
|
|
services.AddSingleton<MainWindow>();
|
|
|
|
//services.AddSingleton<MainViewModel>();
|
|
services.AddSingleton<PlayerViewModel>();
|
|
//services.AddSingleton<PlayingSongInfoViewModel>();
|
|
services.AddSingleton<PlaylistViewModel>();
|
|
|
|
services.AddSingleton<IAudioBitmapImageCache, AudioBitmapImageCache>();
|
|
services.AddSingleton<IStorageProvider, WindowsStorageProvider>();
|
|
|
|
services.AddHarmonia();
|
|
|
|
ServiceProvider = services.BuildServiceProvider();
|
|
}
|
|
|
|
public App()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
|
{
|
|
_mainWindow = ServiceProvider.GetRequiredService<MainWindow>();
|
|
_mainWindow.Activate();
|
|
}
|
|
} |