Example #1
0
 private void btnSignIn_Click(object sender, RoutedEventArgs e)
 {
     if (new Regex(_pattern).IsMatch(tbLogin.Text))
     {
         try
         {
             App.CustomerViewModel.CurrentCustomer = LogisticSystem.GetCustomer(tbLogin.Text, tbPassword.Text);
             CustomerWindow cw = new CustomerWindow();
             cw.Show();
             Close();
         }
         catch (ArgumentException exc)
         {
             MessageBox.Show(exc.Message);
         }
     }
     else
     {
         try
         {
             App.DriverViewModel.CurrentDriver = LogisticSystem.GetDriver(tbLogin.Text, tbPassword.Text);
             DriverWindow dw = new DriverWindow();
             dw.Show();
             Close();
         }
         catch (ArgumentException exc)
         {
             MessageBox.Show(exc.Message);
         }
     }
 }
Example #2
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     if (tbFN.Text != null && tbLN.Text == "" || tbLN.Text == null)
     {
         CustomerWindow cw = new CustomerWindow();
         cw.Show();
         Close();
     }
     else if (tbFN.Text != null && tbLN.Text != null)
     {
         DriverWindow dw = new DriverWindow();
         dw.Show();
         Close();
     }
 }