protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); DispatcherUnhandledException += (sender, args) => { ReporterService.Instance.SendCrashReport(args.Exception); MessageBox.Show( $"An unhandled error has occurred:\n{args.Exception.Message}\n\n{args.Exception.StackTrace}", "Fatal error", MessageBoxButton.OK, MessageBoxImage.Error); args.Handled = true; }; ItemsPreset.LazyInitialize(); BgmPreset.LazyInitialize(); IUnityContainer container = new UnityContainer() .AddExtension(new Diagnostic()) .RegisterSingleton <IWindowManager, WindowManager>() .RegisterSingleton <IFileDialogManager, FileDialogManager>() .RegisterInstance <IApplicationStartup>(new ApplicationStartup(e.Args)) .RegisterSingleton <IAlertMessage, AlertMessage>() .RegisterSingleton <IUpdater, UpdaterService>() .RegisterSingleton <IAppIdentity, DesktopAppIdentity>() ; container.Resolve <MainWindow>().Show(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ItemsPreset.LazyInitialize(); BgmPreset.LazyInitialize(); IUnityContainer container = new UnityContainer() .RegisterSingleton <IWindowManager, WindowManager>() .RegisterSingleton <IFileDialogManager, FileDialogManager>() .RegisterInstance <IApplicationStartup>(new ApplicationStartup(e.Args)) .RegisterSingleton <IAlertMessage, AlertMessage>() .RegisterSingleton <IUpdater, UpdaterService>() ; container.Resolve <MainWindow>().Show(); }
private void Initialize(StartupEventArgs e) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); DispatcherUnhandledException += (sender, args) => { CaptureException(args.Exception); args.Handled = true; }; ItemsPreset.LazyInitialize(); BgmPreset.LazyInitialize(); IUnityContainer container = new UnityContainer() .AddExtension(new Diagnostic()) .RegisterSingleton <IWindowManager, WindowManager>() .RegisterSingleton <IFileDialogManager, FileDialogManager>() .RegisterInstance <IApplicationStartup>(new ApplicationStartup(e.Args)) .RegisterSingleton <IAlertMessage, AlertMessage>() .RegisterSingleton <IUpdater, UpdaterService>() .RegisterSingleton <IAppIdentity, DesktopAppIdentity>() ; container.Resolve <MainWindow>().Show(); }