Пример #1
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();
     }
         );
 }
Пример #2
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();
        }