private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     //Stop the loading  RUNS when thread is COMPLETED can work on UI
     BtnCreateUser.Content  = "Register";
     BtnLoginUser.IsEnabled = true;
     LoadSpinner.Visibility = Visibility.Hidden;
     LoadSpinner.Stop();
     LoadSpinner.Close();
     if (loginUser != null)
     {
         if (loginUser.IsAdmin)
         {
             Window WindowAdminMenu = new AdminWindow(loginUser);
             WindowAdminMenu.Show();
             Close();
         }
         else if (loginUser.IsCustomer)
         {
             Window WindowCustomerMenu = new CustomerScreen(loginUser);
             WindowCustomerMenu.Show();
             Close();
         }
         else
         {
             lblInvalidText.Content = "Invalid Account Information";
         }
     }
     else
     {
         lblInvalidText.Visibility = Visibility.Visible;
     }
 }
 private void BtnMenu_Click(object sender, RoutedEventArgs e)
 {
     if (user.IsAdmin == true)
     {
         Window WindowAdminMenu = new AdminWindow(user);
         WindowAdminMenu.Show();
         Close();
     }
     else
     {
         //user in customerscreen constructor
         Window WindowCustomerMenu = new CustomerScreen(user);
         WindowCustomerMenu.Show();
         Close();
     }
 }
Exemple #3
0
 private void BtnCancel_Click(object sender, RoutedEventArgs e)
 {
     if (user.IsAdmin == true)
     {
         Window WindowAdminMenu = new AdminWindow(user);
         WindowAdminMenu.Show();
         Close();
     }
     else if (user.IsCustomer == true)
     {
         Window WindowCustomerSrc = new CustomerScreen(user);
         WindowCustomerSrc.Show();
         Close();
     }
     else
     {
         Window WindowCustomerSrceen = new CustomerScreen();
         WindowCustomerSrceen.Show();
         Close();
     }
 }