protected override void OnExit(ExitEventArgs e) { if (_dbContext != null) { _dbContext.SaveChanges(); _dbContext.Dispose(); _dbContext = null; } base.OnExit(e); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.DispatcherUnhandledException += App_DispatcherUnhandledException; //System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ru-RU"); _dbContext = new DownworkContext(); #if DEBUG _dbContext.LogToConsole(); #endif }