/// <summary> /// Initializes a new instance of the <see cref="App"/> class. /// </summary> /// <exception cref="T:System.InvalidOperationException">More than one instance of the <see cref="T:System.Windows.Application"/> class is created per <see cref="T:System.AppDomain"/>.</exception> public App() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); Startup += new StartupEventHandler(App_Startup); InitializeComponent(); }
private void Application_Startup(object sender, StartupEventArgs e) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); Settings.CheckUpgrade(); GlobalizationBehavior.ChangeLanguage(Settings.Default.Language); }
public App() { #if !DEBUG // 在异常由应用程序引发但未进行处理时发生。主要指的是UI线程。 DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); // 当某个异常未被捕获时出现。主要指的是非UI线程 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); #endif }
/// <summary> /// Constructor /// </summary> public App() { PhotoFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "KinectPaint"); // The app depends on the My Pictures\KinectPaint folder existing, so create it if it isn't there. if (!Directory.Exists(PhotoFolder)) Directory.CreateDirectory(PhotoFolder); DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); }
/// <summary> /// Constructor /// </summary> public App() { PhotoFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "KinectPaint"); // The app depends on the My Pictures\KinectPaint folder existing, so create it if it isn't there. if (!Directory.Exists(PhotoFolder)) { Directory.CreateDirectory(PhotoFolder); } DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); }
protected override void OnStartup(StartupEventArgs e) { AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly; DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); base.OnStartup(e); }
private void WireUnhandledExceptionHandlers() { var h = new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); AppDomain.CurrentDomain.UnhandledException += h.MakeWeakSpecial(x => AppDomain.CurrentDomain.UnhandledException -= x); var h2 = new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException); Dispatcher.UnhandledException += h2.MakeWeakSpecial(x => Dispatcher.UnhandledException -= x); var h3 = new EventHandler<UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException); TaskScheduler.UnobservedTaskException += h3.MakeWeak(x => TaskScheduler.UnobservedTaskException -= x); }
public App() { IAppender[] appenders = LogManager.GetLogger(typeof(App)).Logger.Repository.GetAppenders(); if (appenders.Length > 0 && appenders[0] is FileAppender) { FileAppender appender = (FileAppender)appenders[0]; string dirName = "LorealOptimiseLog\\"; appender.File = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), dirName) + "\\"; appender.ActivateOptions(); } Logger.assembly = Assembly.GetExecutingAssembly(); log4net.Config.XmlConfigurator.Configure(); //Logger.Log("Connection string:" + DbDataContext.GetInstance().Connection.ConnectionString, LogLevel.Info); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); }
public App() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); }
public App() { DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); }
public App() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); }
public App() { DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); Startup += new StartupEventHandler(App_Startup); TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; }
protected override void OnStartup(StartupEventArgs e) { DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); base.OnStartup(e); }
/// <summary> /// Initializes a new instance of the <see cref="App"/> class. /// </summary> /// <exception cref="T:System.InvalidOperationException">More than one instance of the <see cref="T:System.Windows.Application"/> class is created per <see cref="T:System.AppDomain"/>.</exception> public App() { DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Application_DispatcherUnhandledException); Startup += new StartupEventHandler(Application_Startup); InitializeComponent(); }