2 using System.Collections.Generic;
6 using System.Windows.Controls;
7 using System.Windows.Data;
8 using System.Windows.Documents;
9 using System.Windows.Input;
10 using System.Windows.Media;
11 using System.Windows.Media.Imaging;
12 using System.Windows.Shapes;
13 using System.Text.RegularExpressions;
15 namespace SeciUserInterface.Dialogs.Alerts
22 private static Regex regex =
new Regex(
"^[0-9]+$", RegexOptions.Compiled);
23 public string Name =
"";
24 public string Number =
"";
28 InitializeComponent();
40 if (String.IsNullOrEmpty(txtUser.Text))
42 MessageBox.Show(
"Please enter a name",
"Enter Name", MessageBoxButton.OK, MessageBoxImage.Exclamation);
47 if (String.IsNullOrEmpty(txtNumber.Text))
49 MessageBox.Show(
"Please enter a mobile number",
"Enter Number", MessageBoxButton.OK, MessageBoxImage.Exclamation);
53 String number = txtNumber.Text.Replace(
" ",
"");
55 if (!regex.IsMatch(number))
57 MessageBox.Show(
"Mobile number can only contain numbers",
"Invalid Number", MessageBoxButton.OK, MessageBoxImage.Exclamation);
void btnCancel_Click(object sender, RoutedEventArgs e)
void btnOk_Click(object sender, RoutedEventArgs e)
Interaction logic for AddUser.xaml