-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRasterDialog.xaml.cs
More file actions
34 lines (29 loc) · 1.16 KB
/
RasterDialog.xaml.cs
File metadata and controls
34 lines (29 loc) · 1.16 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
using System.Windows;
namespace NCHops;
public partial class RasterDialog : Window
{
public double RasterX { get; private set; }
public double RasterY { get; private set; }
public RasterDialog(double currentX, double currentY)
{
InitializeComponent();
var inv = System.Globalization.CultureInfo.InvariantCulture;
TxtRasterX.Text = currentX.ToString(inv);
TxtRasterY.Text = currentY.ToString(inv);
}
private void OnOk(object sender, RoutedEventArgs e)
{
var inv = System.Globalization.CultureInfo.InvariantCulture;
if (!double.TryParse(TxtRasterX.Text, System.Globalization.NumberStyles.Float, inv, out var rx) || rx <= 0 ||
!double.TryParse(TxtRasterY.Text, System.Globalization.NumberStyles.Float, inv, out var ry) || ry <= 0)
{
MessageBox.Show(this, "Bitte gültige positive Werte für X und Y eingeben.", "Fehler",
MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
RasterX = rx;
RasterY = ry;
DialogResult = true;
}
private void OnCancel(object sender, RoutedEventArgs e) => DialogResult = false;
}