12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows;
- namespace AwInitilizer
- {
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : Application
- {
- public App():base()
- {
- DispatcherUnhandledException += App_DispatcherUnhandledException;
- }
- private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
- {
- var fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
- File.WriteAllText(fileName,e.Exception.Message);
- File.WriteAllText(fileName, e.Exception.StackTrace);
- MessageBox.Show($"App crashed,Please report error and send back {fileName}");
- Application.Current.Shutdown();
- }
- }
- }
|