mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-05-17 10:51:12 -05:00
36 lines
1.2 KiB
C#
36 lines
1.2 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<ISettingsService, SettingsService>();
|
|
|
|
// View models
|
|
SimpleIoc.Default.Register<IMainViewModel, MainViewModel>();
|
|
SimpleIoc.Default.Register<ISettingsViewModel, SettingsViewModel>();
|
|
|
|
// Load settings
|
|
ServiceLocator.Current.GetInstance<ISettingsService>().Load();
|
|
}
|
|
|
|
public static void Cleanup()
|
|
{
|
|
// Save settings
|
|
ServiceLocator.Current.GetInstance<ISettingsService>().Save();
|
|
}
|
|
|
|
public IMainViewModel MainViewModel => ServiceLocator.Current.GetInstance<IMainViewModel>();
|
|
public ISettingsViewModel SettingsViewModel => ServiceLocator.Current.GetInstance<ISettingsViewModel>();
|
|
}
|
|
} |