You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
using CommonServiceLocator;
|
|
using DiscordChatExporter.Cli.ViewModels;
|
|
using DiscordChatExporter.Core.Services;
|
|
using GalaSoft.MvvmLight.Ioc;
|
|
|
|
namespace DiscordChatExporter.Cli
|
|
{
|
|
public class Container
|
|
{
|
|
public IMainViewModel MainViewModel => Resolve<IMainViewModel>();
|
|
public ISettingsService SettingsService => Resolve<ISettingsService>();
|
|
|
|
private T Resolve<T>(string key = null)
|
|
{
|
|
return ServiceLocator.Current.GetInstance<T>(key);
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
|
SimpleIoc.Default.Reset();
|
|
|
|
// Services
|
|
SimpleIoc.Default.Register<IDataService, DataService>();
|
|
SimpleIoc.Default.Register<IExportService, ExportService>();
|
|
SimpleIoc.Default.Register<IMessageGroupService, MessageGroupService>();
|
|
SimpleIoc.Default.Register<ISettingsService, SettingsService>();
|
|
|
|
// View models
|
|
SimpleIoc.Default.Register<IMainViewModel, MainViewModel>(true);
|
|
}
|
|
|
|
public void Cleanup()
|
|
{
|
|
}
|
|
}
|
|
} |