using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; using Vinno.IUS.Common.Log; namespace vCloud.GeneratePackages.Tool { /// /// Interaction logic for App.xaml /// public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { AppManager.MainDispatcher = Current.Dispatcher; AppDomain.CurrentDomain.UnhandledException += OnDomainUnhandledException; Current.DispatcherUnhandledException += OnCurrentDispatcherUnhandledException; base.OnStartup(e); } private void OnDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) { Logger.WriteLineError($"OnDomainUnhandledException: {e.ExceptionObject}"); Dispatcher.Invoke(() => { MessageBox.Show($"OnDomainUnhandledException{e.ExceptionObject}"); }); } private void OnCurrentDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { Logger.WriteLineError($"OnCurrentDispatcherUnhandledException: {e.Exception}"); Dispatcher.Invoke(() => { MessageBox.Show($"OnCurrentDispatcherUnhandledException: {e.Exception}"); }); } } }