示例#1
0
        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();
        }
示例#2
0
 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();
     }
         );
 }
示例#3
0
        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();
        }