-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
78 lines (72 loc) · 2.55 KB
/
MainWindow.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Windows;
using System.Windows.Input;
using Gurock.SmartInspect;
using System.Text.RegularExpressions;
namespace TestRadius
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
Logging lg;
public MainWindow()
{
InitializeComponent();
lg = new Logging();
}
private void btnTest_Click(object sender, RoutedEventArgs e)
{
SiAuto.Main.LogVerbose("Testing Radius");
try
{
if ((tbRIP.Text != null & tbRIP.Text != "") & (tbSS.Password != null & tbSS.Password != "") & (tbUN.Text != null & tbUN.Text != "") & (tbPW.Password != null & tbPW.Password != ""))
{
testRadius tRadius = new testRadius();
if(tbPrt.Text == "" | tbPrt.Text == null)
{
tbPrt.Text = "1812";
}
tRadius.GetStatus(tbRIP.Text, Convert.ToInt32(tbPrt.Text), tbSS.Password, tbUN.Text, tbPW.Password);
switch (tRadius.RadiusStatus)
{
case 0:
{
tbResults.Text = "Access Accepted";
}
break;
case -4:
{
tbResults.Text = "Access Rejected";
}
break;
case -8:
{
tbResults.Text = "Access Challenged";
}
break;
default:
{
tbResults.Text = string.Format("Error {1}: {0}", tRadius.RadiusMessage, tRadius.RadiusStatus);
}
break;
}
}
else
{
tbResults.Text = "Please complete filling out the text boxes";
}
}
catch(Exception ex)
{
SiAuto.Main.LogError("Application Error: {0}", ex.Message);
}
}
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^0-9]+");
e.Handled = regex.IsMatch(e.Text);
}
}
}