public void Init() { if (_validator == null) { var existingDb = ConnectionStringUpdater.GetExistingDatabase(); if (existingDb == null) { ChangeDbConnectionString(); } else { ResetValidator(); } } else { _validator.Refresh(); } ErrorTypes = _validator.ErrorTypes; ResetWrongValues(); _sourcesViewViewModel.Init(); }
private void SetDbConnectionString() { ConnectionStringUpdater.UpdateDbConnectionString( () => { }, (ex) => { _log.Error("Exception occurred while updating the connection string", ex); MessageBox.Show(string.Format("An error occurred: '{0}'" + Environment.NewLine + "The application will shut down. Please start it again and select another database.", ex.Message), "Validation toolkit", MessageBoxButton.OK, MessageBoxImage.Error); App.Current.Shutdown(); } ); }
public void ChangeDbConnectionString() { ConnectionStringUpdater.UpdateDbConnectionString( () => { //with the new connection string, a new validator-instance is needed ResetValidator(); }, (ex) => { MessageBox.Show(string.Format("An error occurred during the installation of the validation toolkit: '{0}'" + Environment.NewLine + "The connection was not changed.", ex.Message), "Validation toolkit", MessageBoxButton.OK, MessageBoxImage.Error); } ); if (_validator != null) { _validator.Dispose(); } ResetValidator(); Init(); }