mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-27 13:14:17 -04:00
Refactor
This commit is contained in:
parent
c01b9d0e5f
commit
f2178a0445
6 changed files with 11 additions and 11 deletions
36
DiscordChatExporter/Container.cs
Normal file
36
DiscordChatExporter/Container.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
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>();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue