private void SelectConnectionButton_OnClick(object sender, RoutedEventArgs e) { if (!SelectConnectionButton.IsEnabled) { return; } if (null == _configuredConnection) { ShowErrorMessage("Please select a connection from the List View before attempt to test.", "No Connection Selected"); } SQLConnectionTestResult testResult = _gizmoViewModel.TestSQLConnection(_configuredConnection.ConnectionString); if (testResult.Successful) { this.DialogResult = true; this.Close(); return; } ShowErrorMessage($"There was an error with the connection. Please check the connection string and try again. The error returned is:{Environment.NewLine}{testResult.ResultMessage}", "Connection Error"); }
private void TestConnectionButton_OnClick(object sender, RoutedEventArgs e) { if (!TestConnectionButton.IsEnabled) { return; } if (null == _configuredConnection) { ShowErrorMessage("Please select a connection from the List View before attempt to test.", "No Connection Selected"); } SQLConnectionTestResult testResult = _gizmoViewModel.TestSQLConnection(_configuredConnection.ConnectionString); if (testResult.Successful) { MessageBox.Show($"{testResult.ResultMessage}", "Test successful!", MessageBoxButton.OK, MessageBoxImage.Information); return; } ShowErrorMessage($"The test was not successful. The error message is:{Environment.NewLine}{testResult.ResultMessage}", "Test Failed"); }