diff --git a/Dashboard/SettingsWindow.xaml b/Dashboard/SettingsWindow.xaml
index b86ae316..28f1f02b 100644
--- a/Dashboard/SettingsWindow.xaml
+++ b/Dashboard/SettingsWindow.xaml
@@ -108,7 +108,11 @@
-
+
+
+
+
();
+
prefs.NotifyOnBlocking = NotifyOnBlockingCheckBox.IsChecked == true;
if (int.TryParse(BlockingThresholdTextBox.Text, out int blockingThreshold) && blockingThreshold > 0)
- {
prefs.BlockingThresholdSeconds = blockingThreshold;
- }
+ else if (prefs.NotifyOnBlocking)
+ validationErrors.Add("Blocking threshold must be a positive number");
+
prefs.NotifyOnDeadlock = NotifyOnDeadlockCheckBox.IsChecked == true;
if (int.TryParse(DeadlockThresholdTextBox.Text, out int deadlockThreshold) && deadlockThreshold > 0)
- {
prefs.DeadlockThreshold = deadlockThreshold;
- }
+ else if (prefs.NotifyOnDeadlock)
+ validationErrors.Add("Deadlock threshold must be a positive number");
+
prefs.NotifyOnHighCpu = NotifyOnHighCpuCheckBox.IsChecked == true;
if (int.TryParse(CpuThresholdTextBox.Text, out int cpuThreshold) && cpuThreshold > 0 && cpuThreshold <= 100)
- {
prefs.CpuThresholdPercent = cpuThreshold;
- }
+ else if (prefs.NotifyOnHighCpu)
+ validationErrors.Add("CPU threshold must be between 1 and 100");
+
prefs.NotifyOnPoisonWaits = NotifyOnPoisonWaitsCheckBox.IsChecked == true;
if (int.TryParse(PoisonWaitThresholdTextBox.Text, out int poisonWaitThreshold) && poisonWaitThreshold > 0)
- {
prefs.PoisonWaitThresholdMs = poisonWaitThreshold;
- }
+ else if (prefs.NotifyOnPoisonWaits)
+ validationErrors.Add("Poison wait threshold must be a positive number");
+
prefs.NotifyOnLongRunningQueries = NotifyOnLongRunningQueriesCheckBox.IsChecked == true;
if (int.TryParse(LongRunningQueryThresholdTextBox.Text, out int lrqThreshold) && lrqThreshold > 0)
- {
prefs.LongRunningQueryThresholdMinutes = lrqThreshold;
- }
+ else if (prefs.NotifyOnLongRunningQueries)
+ validationErrors.Add("Long-running query threshold must be a positive number");
+
prefs.NotifyOnTempDbSpace = NotifyOnTempDbSpaceCheckBox.IsChecked == true;
if (int.TryParse(TempDbSpaceThresholdTextBox.Text, out int tempDbThreshold) && tempDbThreshold > 0 && tempDbThreshold <= 100)
- {
prefs.TempDbSpaceThresholdPercent = tempDbThreshold;
- }
+ else if (prefs.NotifyOnTempDbSpace)
+ validationErrors.Add("TempDB space threshold must be between 1 and 100");
+
prefs.NotifyOnLongRunningJobs = NotifyOnLongRunningJobsCheckBox.IsChecked == true;
if (int.TryParse(LongRunningJobMultiplierTextBox.Text, out int jobMultiplier) && jobMultiplier > 0)
- {
prefs.LongRunningJobMultiplier = jobMultiplier;
+ else if (prefs.NotifyOnLongRunningJobs)
+ validationErrors.Add("Job multiplier must be a positive number");
+
+ if (validationErrors.Count > 0)
+ {
+ MessageBox.Show(
+ "Some alert thresholds have invalid values and were not changed:\n\n" +
+ string.Join("\n", validationErrors),
+ "Validation", MessageBoxButton.OK, MessageBoxImage.Warning);
}
// Save SMTP email settings
diff --git a/Lite/Windows/SettingsWindow.xaml b/Lite/Windows/SettingsWindow.xaml
index a9c65ec3..d6501a29 100644
--- a/Lite/Windows/SettingsWindow.xaml
+++ b/Lite/Windows/SettingsWindow.xaml
@@ -96,7 +96,11 @@
-
+
+
+
+