This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora/App.xaml.cs

69 lines
2.2 KiB
C#
Raw Normal View History

2019-05-16 22:07:36 +00:00
using System;
2019-07-05 18:17:09 +00:00
using Aurora.Design.Views.Main;
2020-02-01 01:41:45 +00:00
using Aurora.Design.Views.Albums;
using Aurora.Design.Views.Artists;
using Aurora.Design.Views.Party;
using Aurora.Design.Views.Profile;
using Aurora.Design.Views.Songs;
using Aurora.Design.Views.Stations;
using Aurora.Services.ClientService;
using Autofac;
using LibVLCSharp.Shared;
2019-05-16 22:07:36 +00:00
using Xamarin.Forms;
2020-02-01 01:41:45 +00:00
using Aurora.Services.Player;
using Aurora.Services.Settings;
using Aurora.Services.Library;
2019-05-16 22:07:36 +00:00
namespace Aurora
{
public partial class App : Application
{
2020-02-01 01:41:45 +00:00
private static IContainer _container;
2019-05-16 22:07:36 +00:00
public App()
{
InitializeComponent();
Core.Initialize();
2019-05-16 22:07:36 +00:00
2020-02-01 01:41:45 +00:00
//Register DI
ContainerBuilder _builder = new ContainerBuilder();
// _builder.RegisterInstance<IPlayer>(new PlayerService()).SingleInstance();
_builder.RegisterType<PlayerService>().As<IPlayer>().SingleInstance();
_builder.RegisterType<SettingsService>().As<ISettingsService>().SingleInstance();
_builder.RegisterType<ClientService>().As<IClientService>().SingleInstance();
_builder.RegisterType<LibraryService>().As<ILibraryService>().SingleInstance();
2020-02-01 01:41:45 +00:00
_builder.RegisterType<MainView>().SingleInstance();
_builder.RegisterType<AlbumsViewModel>();
_builder.RegisterType<ArtistsViewModel>();
_builder.RegisterType<PartyViewModel>();
_builder.RegisterType<ProfileViewModel>();
_builder.RegisterType<SongsViewModel>();
_builder.RegisterType<StationsViewModel>();
// _builder.RegisterInstance<ISettingsService>(new SettingsService()).SingleInstance();
_container = _builder.Build();
MainPage = _container.Resolve<MainView>();
}
public static IContainer Container
{
get { return _container; }
2019-05-16 22:07:36 +00:00
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}