Пример #1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            /* if both textboxes are not empty
             * the login window will close and the
             * success window will open.
             * Ali*/
            if (isValid())
            {
                /* the program will send the username and password text fields to the
                 * UserProcessor class to make sure that the values are correct
                 * Ali*/
                var userInfo = await UserProcessor.LoadUser(txtUsername.Text, txtPassword.Password);

                /* If the user inputs an invalid username or password
                 * the User object's properites will all be null, so
                 * exception logic is required here
                 * Ali*/
                try
                {
                    if (userInfo.Privileges == "Admin")
                    {
                        UIRedesign s = new UIRedesign(userInfo);
                        Console.WriteLine(userInfo.Token);
                        s.Show();
                        this.Close();
                    }
                    else if (userInfo.Privileges == "Employee")
                    {
                    }
                    else
                    {
                        MessageBox.Show("Customers not permitted on this platform.", "Login Failed");
                    }
                }
                catch
                {
                    txtPassword.Clear();
                    MessageBox.Show("Either username or passord is incorrect.", "Login Failed");
                }
            }
        }
Пример #2
0
        private void btnUIRedesign_Click(object sender, RoutedEventArgs e)
        {
            UIRedesign ui = new UIRedesign(currentUser);

            ui.Show();
        }