private void ShowExceptionCarefully(Exception exception) { try { userDecisionsService.ShowException(exception); } catch (Exception ex) { // This can occure in UT if mock for ShowException is not defined explicitly. // In production we do not expect any exception here. ;//LOGGER.Error("Unexpected exception of userDecisionsService", ex); } }
public MainWindow() { List <string> picturesList = CreatePicturesList(); SplashScreen splashScreen = CreateSplashScreen(picturesList); InitializeComponent(); userDecisionsService = new UserDecisionsService(); try { DomainContext = new DomainContext(); DomainContext.CloseMainWindow = Close; DataContext = new MainWindowViewModel(DomainContext); loadService = new LoadingService(DomainContext, LoadingBackgroung, WaitControl); SetDomainContext(); SubscribeMessenger(); if (splashScreen != null) { DateTime now = DateTime.Now.AddSeconds(3); splashScreen.Close(TimeSpan.FromSeconds(1)); while (DateTime.Now < now) { } } SetMainTimer(); } catch (Exception e) { userDecisionsService.ShowException(e); Close(); } }