mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-06-05 09:13:44 -04:00
41 lines
No EOL
1.7 KiB
C#
41 lines
No EOL
1.7 KiB
C#
using DiscordChatExporter.Services;
|
|
using DiscordChatExporter.ViewModels;
|
|
using GalaSoft.MvvmLight.Ioc;
|
|
using Microsoft.Practices.ServiceLocation;
|
|
|
|
namespace DiscordChatExporter
|
|
{
|
|
public class Container
|
|
{
|
|
public static void Init()
|
|
{
|
|
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
|
|
|
// 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<IErrorViewModel, ErrorViewModel>(true);
|
|
SimpleIoc.Default.Register<IMainViewModel, MainViewModel>(true);
|
|
SimpleIoc.Default.Register<ISettingsViewModel, SettingsViewModel>(true);
|
|
SimpleIoc.Default.Register<IExportDoneViewModel, ExportDoneViewModel>(true);
|
|
|
|
// Load settings
|
|
ServiceLocator.Current.GetInstance<ISettingsService>().Load();
|
|
}
|
|
|
|
public static void Cleanup()
|
|
{
|
|
// Save settings
|
|
ServiceLocator.Current.GetInstance<ISettingsService>().Save();
|
|
}
|
|
|
|
public IErrorViewModel ErrorViewModel => ServiceLocator.Current.GetInstance<IErrorViewModel>();
|
|
public IMainViewModel MainViewModel => ServiceLocator.Current.GetInstance<IMainViewModel>();
|
|
public ISettingsViewModel SettingsViewModel => ServiceLocator.Current.GetInstance<ISettingsViewModel>();
|
|
public IExportDoneViewModel ExportDoneViewModel => ServiceLocator.Current.GetInstance<IExportDoneViewModel>();
|
|
}
|
|
} |