Example #1
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            loginProgressBar.PerformStep();
            errorLabel.Text = "Logging in...";
            string text    = peopleFoundListbox.GetItemText(peopleFoundListbox.SelectedItem);
            string pattern = @"\s--\s";

            string[] elements = System.Text.RegularExpressions.Regex.Split(text, pattern); //gets username, password, name from list

            HAC             hac      = new HAC();
            HttpWebResponse response = hac.login(elements[1], elements[2], out var container); //starts with second element bc first one is name

            loginProgressBar.PerformStep();
            errorLabel.Text = "Logged in!";
            bool validLogin = hac.isValidLogin(response);

            if (validLogin != true) //checks if login creds are true
            {
                string[] errorText = { "Either the HAC username or password is incorrect." };
                errorLabel.Text = errorText[0];
                return;
            }
            hac.GetCourses(container, response.ResponseUri);//logs in and fetches grades
            Hide();
            ViewStats viewStats = new ViewStats();

            viewStats.ShowDialog();
        }
Example #2
0
        private void directLoginButton_Click(object sender, EventArgs e)
        {
            HAC             hac      = new HAC();
            HttpWebResponse response = hac.login(newUserUsernameText.Text, newUserPasswordText.Text, out var container); //starts with second element bc first one is name

            hac.GetCourses(container, response.ResponseUri);                                                             //logs in and fetches grades

            //foreach (Course assignment in assignments)
            //{ Console.WriteLine(assignment); }
        }