Esempio n. 1
0
        private void OnDispatcherUnhandledException(object sender,
                                                    DispatcherUnhandledExceptionEventArgs e)
        {
            MessageBox.Show(e.Exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            e.Handled = true;

            HospitalLogger.LogError("Unexpected errror occurred: \"{0}\" in {1}", e.Exception.Message,
                                    e.Exception.TargetSite);
        }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();

            Dispatcher.UnhandledException += OnDispatcherUnhandledException;
            HospitalLogger.AddLoggingTarget(new FileLoggingTarget());

            try
            {
                HtmlLoader templateLoader = Factory.BuildHtmlLoader();
                templateLoader.Load();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                HospitalLogger.LogError("Unexpected errror occurred: \"{0}\" in {1}", ex.Message,
                                        ex.TargetSite);
                Environment.Exit(-1);
            }

            Switcher.PageSwitcher = this;
            Switcher.Switch(new StartPage());
        }