public RegisterPage() { InitializeComponent(); InputTicketCode.ReturnCommand = new Command(() => InputFirstName.Focus()); InputFirstName.ReturnCommand = new Command(() => InputSurname.Focus()); InputOtherRemarks.ReturnCommand = new Command(() => InputEmail.Focus()); InputEmail.ReturnCommand = new Command(() => InputPassword.Focus()); InputPassword.ReturnCommand = new Command(() => InputConfirmPassword.Focus()); }
private void SubmitLogin_OnClick(object sender, RoutedEventArgs e) { UserModel user = new UserModel(); Dispatcher.Invoke(() => { try { if (user.Login(InputEmail.Text, InputPassword.Password)) { switch (user.RoleId) { case 1: //Admin Admin admin = new Admin(); admin.Show(); //Close Login Window Close(); break; case 2: //Secretary Secretary secretary = new Secretary(); secretary.Show(); //Close Login Window Close(); break; case 3: //Staff Staff staff = new Staff(); staff.Show(); //Close Login Window Close(); break; case 4: //Student Student userStudent = new Student(); //Open Student Window userStudent.Show(); Close(); break; } } else { ErrorMsg.Text = user.error; InputPassword.Password = ""; InputEmail.Focus(); } } catch (Exception ex) { MessageBox.Show(ex + String.Empty); } }); }