private async void Window_Loaded(object sender, RoutedEventArgs e) { string nameOrConnectionString = ConfigurationManager.AppSettings.Get("SelectedConnectionStringName"); _uowFactory = new UoWFactory(nameOrConnectionString); Log("Starting up database..."); SetBtnsAvailability(false); await Task.Run(() => { _uowFactory.Initialize(); _uow = _uowFactory.CreateNew(); }); SetBtnsAvailability(true); Log("Loaded"); }