Exemplo n.º 1
0
        public App()
        {
            _diConfiguration = new DependencyInjectionConfiguration();
            _errorHandler = _diConfiguration.Container.Resolve<IErrorHandler>();

            try
            {
                _model = _diConfiguration.Container.Resolve<IApplicationModel>();
                Startup += (s, e) => _model.Start();
                _model.Exited += () => Shutdown();

                DispatcherUnhandledException += (s, e) => e.Handled = _errorHandler.Handle(e.Exception);
            }
            catch (Exception ex)
            {
                if (_errorHandler == null)
                    throw;

                _errorHandler.Handle(ex);
            }
        }