-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModifyGeneratorDialog.xaml.cs
51 lines (43 loc) · 1.41 KB
/
ModifyGeneratorDialog.xaml.cs
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
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Input;
namespace CircuitPro
{
/// <summary>
/// Interaction logic for ModifyGeneratorDialog.xaml
/// </summary>
public partial class ModifyGeneratorDialog : Window
{
public double Frecventa => FrecventaText.Text != "" ? double.Parse(FrecventaText.Text) : 0;
public double Tensiune => TensiuneText.Text != "" ? double.Parse(TensiuneText.Text) : 0;
public ModifyGeneratorDialog(double frecventa, double tensiune)
{
InitializeComponent();
// valori inițiale
FrecventaText.Text = frecventa.ToString();
TensiuneText.Text = tensiune.ToString();
}
private void VerificareInputNumar(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^0-9.]+");
e.Handled = regex.IsMatch(e.Text);
}
private void TextInput_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Space)
{
e.Handled = true;
}
base.OnPreviewKeyDown(e);
}
private void ApplyBtn_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
}
private void CancelBtn_Click(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
}
}