-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDialogUtilities.cs
More file actions
38 lines (32 loc) · 1.4 KB
/
DialogUtilities.cs
File metadata and controls
38 lines (32 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
namespace Where1.WPlot
{
public static class DialogUtilities
{
public static void ShowGenericPlotNotAddedError()
{
MessageBox.Show(App.Current.MainWindow, "Something went wrong. Your plot was not added. Make sure your data is of the right format for the settings you chose.", "Unknown Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
public static void ShowSpecificPlotError(string errorType, Exception error = null, bool shouldExit = false, string errorBlurb = "Something went wrong.")
{
var dlg = new SpecificErrorDialog(errorType, errorBlurb, error);
dlg.Owner = App.Current.MainWindow;
dlg.ShowDialog();
if (shouldExit)
{
App.Current.MainWindow.Close();
}
}
public static void ShowCouldNotParseNumberError(string parameterName, string value)
{
ShowSpecificPlotError("Parsing Error", null, false, $"\"{parameterName}\" had value \"{value}\" which could not be read as a number.");
}
public static void ShowCouldNotParseValueError(string parameterName, string value)
{
ShowSpecificPlotError("Parsing Error", null, false, $"\"{parameterName}\" had value \"{value}\" which was not valid.");
}
}
}