Exemplo n.º 1
0
        public void SignIn()
        {
            if (!EmailValidator.Validate())
            {
                return;
            }

            Admin admin;

            try {
                admin = Business.Admin(new Email(email.Text));
                EmailValidator.ResetError();
            } catch (InexistentEmailException ex) {
                EmailValidator.SetError(ex.Message);
                return;
            }

            if (!PasswordValidator.Validate())
            {
                return;
            }

            try {
                AdminSession.SignIn(admin, password.Password);
                PasswordValidator.ResetError();
                Frame.Navigate(new AdminPage(Business, Frame));
            } catch (WrongPasswordException ex) {
                PasswordValidator.SetError(ex.Message);
            }
        }
Exemplo n.º 2
0
        public void SignIn()
        {
            if (!EmailValidator.Validate() || !PasswordValidator.Validate())
            {
                return;
            }

            try {
                Host host = Business.Host(new Email(email.Text));
                EmailValidator.ResetError();

                HostSession.SignIn(host, password.Password);
                PasswordValidator.ResetError();

                Frame.Navigate(new HostPage(Business, HostSession, Frame));
            } catch (InexistentEmailException ex) {
                EmailValidator.SetError(ex.Message);
            } catch (WrongPasswordException ex) {
                PasswordValidator.SetError(ex.Message);
            }
        }