DiscordChatExporter/DiscordChatExporter.Gui/Bootstrapper.cs

45 lines
1.2 KiB
C#
Raw Normal View History

2020-04-21 14:30:42 -04:00
using DiscordChatExporter.Gui.Services;
using DiscordChatExporter.Gui.ViewModels;
using DiscordChatExporter.Gui.ViewModels.Framework;
using Stylet;
using StyletIoC;
2019-11-13 12:19:36 -05:00
#if !DEBUG
using System.Windows;
using System.Windows.Threading;
#endif
namespace DiscordChatExporter.Gui
{
public class Bootstrapper : Bootstrapper<RootViewModel>
{
2020-10-05 10:10:00 -04:00
protected override void OnStart()
{
base.OnStart();
2020-10-24 14:15:58 -04:00
// Set default theme
// (preferred theme will be chosen later, once the settings are loaded)
2020-10-05 10:10:00 -04:00
App.SetLightTheme();
}
protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
base.ConfigureIoC(builder);
// Bind settings as singleton
builder.Bind<SettingsService>().ToSelf().InSingletonScope();
// Bind view model factory
builder.Bind<IViewModelFactory>().ToAbstractFactory();
}
#if !DEBUG
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
base.OnUnhandledException(e);
MessageBox.Show(e.Exception.ToString(), "Error occured", MessageBoxButton.OK, MessageBoxImage.Error);
}
#endif
}
}