2020-03-30 19:43:04 +02:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
using AutoMapper;
|
2020-04-21 13:07:17 +02:00
|
|
|
|
using GalaSoft.MvvmLight.Views;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2020-04-21 17:13:39 +02:00
|
|
|
|
using Microsoft.HockeyApp;
|
2020-04-21 13:07:17 +02:00
|
|
|
|
using ModernKeePass.Common;
|
|
|
|
|
using ModernKeePass.Views;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
|
|
|
|
|
namespace ModernKeePass
|
|
|
|
|
{
|
|
|
|
|
public static class DependencyInjection
|
|
|
|
|
{
|
2020-04-21 13:07:17 +02:00
|
|
|
|
public static IServiceCollection AddWin81App(this IServiceCollection services)
|
2020-03-30 19:43:04 +02:00
|
|
|
|
{
|
|
|
|
|
var applicationAssembly = typeof(Application.DependencyInjection).GetTypeInfo().Assembly;
|
|
|
|
|
var infrastructureAssembly = typeof(Infrastructure.DependencyInjection).GetTypeInfo().Assembly;
|
|
|
|
|
services.AddAutoMapper(applicationAssembly, infrastructureAssembly);
|
|
|
|
|
|
2020-04-21 13:07:17 +02:00
|
|
|
|
services.AddSingleton<INavigationService>(provider =>
|
|
|
|
|
{
|
|
|
|
|
var nav = new NavigationService();
|
|
|
|
|
nav.Configure(Constants.Navigation.MainPage, typeof(MainPage));
|
|
|
|
|
nav.Configure(Constants.Navigation.EntryPage, typeof(EntryDetailPage));
|
|
|
|
|
nav.Configure(Constants.Navigation.GroupPage, typeof(GroupDetailPage));
|
|
|
|
|
return nav;
|
|
|
|
|
});
|
2020-04-21 19:12:26 +02:00
|
|
|
|
services.AddTransient(typeof(IDialogService), typeof(DialogService));
|
2020-04-21 17:13:39 +02:00
|
|
|
|
|
|
|
|
|
services.AddSingleton(provider =>
|
|
|
|
|
{
|
|
|
|
|
#if DEBUG
|
|
|
|
|
HockeyClient.Current.Configure("2fe83672-887b-4910-b9de-93a4398d0f8f");
|
|
|
|
|
#else
|
|
|
|
|
HockeyClient.Current.Configure("9eb5fbb79b484fbd8daf04635e975c84");
|
|
|
|
|
#endif
|
|
|
|
|
return HockeyClient.Current;
|
|
|
|
|
});
|
2020-04-21 13:07:17 +02:00
|
|
|
|
|
2020-03-30 19:43:04 +02:00
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|