Beispiel #1
0
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            Window Window = new HostMainWindow(host);

            Window.Show();
            Close();
        }
Beispiel #2
0
        private void TryLoginToUser(string username, string password)
        {
            try
            {
                user = bl.GetUser(username);

                if (password == user.Password)
                {
                    if (user.Type == UserType.Guest)
                    {
                        Guest  guest       = GetGuest(user);
                        Window guestWindow = new GuestMainWindow(guest);
                        guestWindow.Show();
                    }
                    else if (user.Type == UserType.Host)
                    {
                        if (!user.FinishedRegistration)
                        {
                            CompleteHostRegistration(user);
                        }
                        else
                        {
                            Host   host           = GetHost(user);
                            Window hostMainWindow = new HostMainWindow(host);
                            hostMainWindow.Show();
                        }
                    }
                    Close();
                }
                else
                {
                    throw new BlUserDoesNotExistException();
                }
            }
            catch (BlUserDoesNotExistException)
            {
                this.username.Text     = "";
                this.password.Password = "";
                MessageBox.Show("Username or Password is incorrect.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }