protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var mainWindow = new MainWindow(); IIoCService iocService = new IoCService { RegisterComponents = (ioc) => { ioc.RegisterType <ESPMessageService>().As <IESPMessageService>(true); ioc.RegisterType <HTTPServer>().As <IHTTPServer>(); } }; iocService.Build(); iocService.Resolve <IAppService>().SetTheme(ThemeType.Light); mainWindow.DataContext = iocService.Resolve <IMainWindowViewModel>(); mainWindow.Show(); iocService.Resolve <INavigationService>().NavigateTo <FindESPViewModel, FindESPView>(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var window = new MainWindow(); IIoCService iocService = new IoCService { RegisterComponents = (ioc) => { ioc.RegisterType <ESPMessageService>().As <IESPMessageService>(); } }; iocService.Build(); iocService.Resolve <IAppService>().SetTheme(ThemeType.Light); window.DataContext = iocService.Resolve <IMainWindowViewModel>(); window.Show(); iocService.Resolve <INavigationService>().NavigateTo <FindESPViewModel, FindESPView>(); AppDomain.CurrentDomain.UnhandledException += (s, e) => iocService.Resolve <IAppService>().ProcessException((Exception)e.ExceptionObject, "Domain exception"); Dispatcher.UnhandledException += (s, e) => { e.Handled = true; iocService.Resolve <IAppService>().ProcessException(e.Exception, "Dispatcher exception"); }; TaskScheduler.UnobservedTaskException += (s, e) => { if (e.Exception != null) { iocService.Resolve <IAppService>().ProcessException(e.Exception, "Unobserved exception"); e.SetObserved(); } }; }