Fix settings not loading early enough

pull/17/head
Alexey Golub 7 years ago
parent d7345e91d3
commit 6ccaf3f106

@ -11,11 +11,14 @@ namespace DiscordChatExporter
{ {
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
// Settings
SimpleIoc.Default.Register<ISettingsService, SettingsService>();
ServiceLocator.Current.GetInstance<ISettingsService>().Load();
// Services // Services
SimpleIoc.Default.Register<IDataService, DataService>(); SimpleIoc.Default.Register<IDataService, DataService>();
SimpleIoc.Default.Register<IExportService, ExportService>(); SimpleIoc.Default.Register<IExportService, ExportService>();
SimpleIoc.Default.Register<IMessageGroupService, MessageGroupService>(); SimpleIoc.Default.Register<IMessageGroupService, MessageGroupService>();
SimpleIoc.Default.Register<ISettingsService, SettingsService>();
// View models // View models
SimpleIoc.Default.Register<IErrorViewModel, ErrorViewModel>(true); SimpleIoc.Default.Register<IErrorViewModel, ErrorViewModel>(true);
@ -23,14 +26,11 @@ namespace DiscordChatExporter
SimpleIoc.Default.Register<IExportSetupViewModel, ExportSetupViewModel>(true); SimpleIoc.Default.Register<IExportSetupViewModel, ExportSetupViewModel>(true);
SimpleIoc.Default.Register<IMainViewModel, MainViewModel>(true); SimpleIoc.Default.Register<IMainViewModel, MainViewModel>(true);
SimpleIoc.Default.Register<ISettingsViewModel, SettingsViewModel>(true); SimpleIoc.Default.Register<ISettingsViewModel, SettingsViewModel>(true);
// Load settings
ServiceLocator.Current.GetInstance<ISettingsService>().Load();
} }
public static void Cleanup() public static void Cleanup()
{ {
// Save settings // Settings
ServiceLocator.Current.GetInstance<ISettingsService>().Save(); ServiceLocator.Current.GetInstance<ISettingsService>().Save();
} }

Loading…
Cancel
Save