private static void Dispatcher_UnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            TMPApp app = Application.Current as TMPApp;

            string error = TMPApp.GetExceptionDetails(e.Exception);

#if DEBUG
            System.Diagnostics.Debug.WriteLine(error);
#endif
            logger?.Error(e.Exception);
            if (e.Exception.GetType() == typeof(System.IO.FileNotFoundException))
            {
                ShowError("Не удалось найти файл.\n" + e.Exception.Message + "\nПопробуйте переустановить приложение.");
            }
            else if (e.Exception.InnerException != null)
            {
                ShowError(e.Exception.InnerException);
            }
            else
            {
                ShowError(error);
            }

            e.Handled = true;
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TMPApp"/> class.
        /// </summary>
        public TMPApp()
        {
            tMPApp = this;

            logger?.Trace("Инициализация приложения");

            SetAppDomainCultures("ru-RU"); // "be-BY");

            this.Navigating += this.TMPApp_Navigating;
        }