protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); // Set working directory string appData = AboutViewModel.GetAppDataFolder(); Directory.SetCurrentDirectory(appData); // Set logger Log.Logger = new LoggerConfiguration() #if DEBUG .MinimumLevel.Verbose() .WriteTo.Debug() #endif .WriteTo.File( Path.Combine(appData, AboutModel.AssemblyProduct + ".log"), rollingInterval: RollingInterval.Infinite, fileSizeLimitBytes: _maxLogFileSize) .CreateLogger(); Log.Information($"Startup \"{AboutModel.AssemblyProduct}\""); // Exception Handling Wiring AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; TaskScheduler.UnobservedTaskException += UnobservedTaskExceptionHandler; NetworkCamera.Wpf.Properties.Settings.Default.Reload(); EnsureBrowserEmulationEnabled("NetworkCamera.exe"); // Prevent going to sleep mode _ = SetThreadExecutionState(_esContinous | _esSystemRequired); }