Esempio n. 1
0
 private void btnLogOut_Click(object sender, RibbonControlEventArgs e)
 {
     m_state                 = null;
     btnLogOut.Visible       = false;
     grpCourseGrades.Visible = false;
     grpError.Visible        = false;
     btnLogin.Visible        = true;
 }
Esempio n. 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            // Ignore the click if we have an empty user name or password
            if (0 == tbUserName.TextLength)
            {
                tbUserName.Focus();
                return;
            }
            if (0 == tbPassword.TextLength)
            {
                tbPassword.Focus();
                return;
            }

            // Disable the buttons while we're processing
            btnOK.Enabled     = false;
            btnCancel.Enabled = false;
            // Also show the progress bar
            progressBar1.Visible = true;

            // Save user name and password if needed
            if (cbRemember.Checked)
            {
                byte[] encUser = EncryptStringToBytes(tbUserName.Text, s_key, s_iv);
                byte[] encPass = EncryptStringToBytes(tbPassword.Text, s_key, s_iv);
                try
                {
                    File.WriteAllBytes(m_credUFileName, encUser);
                    File.WriteAllBytes(m_credPFileName, encPass);
                }
                catch (Exception) { }
            }
            else // Otherwise delete save files
            {
                if (File.Exists(m_credUFileName))
                {
                    File.Delete(m_credUFileName);
                }
                if (File.Exists(m_credPFileName))
                {
                    File.Delete(m_credPFileName);
                }
            }

            m_state = new OSBLEState(tbUserName.Text, tbPassword.Text);
            m_state.RefreshAsync(this.LoginAttemptCompleted_CT);
        }
Esempio n. 3
0
        private void btnLogin_Click(object sender, RibbonControlEventArgs e)
        {
            m_state = null;
            using (LoginForm lf = new LoginForm())
            {
                m_state = lf.DoPrompt();
                if (null == m_state)
                {
                    return;
                }
            }

            // Put the courses in the drop-down
            ddCourses.Items.Clear();
            foreach (OSBLEServices.Course c in m_state.Courses)
            {
                RibbonDropDownItem item
                           = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                item.Label = c.Name + ", " + c.Semester.Substring(0, 2).ToUpper() + ", " + c.Year;
                item.Tag   = c;
                ddCourses.Items.Add(item);
            }

            if (ddCourses.Items.Count > 0)
            {
                ddCourses.SelectedItemIndex = 0;
                grpCourseGrades.Visible     = true;
                btnLogin.Visible            = false;
                btnLogOut.Visible           = true;
                ddCourses.Visible           = true;
                btnSaveToOSBLE.Visible      = true;
                lblLastSave.Label           = "Last save: (none since login)";

                // Update stuff
                ddCourses_SelectionChanged(null, null);
            }
            else // No courses that can be graded
            {
                grpCourseGrades.Visible = true;
                btnLogin.Visible        = false;
                btnLogOut.Visible       = true;
                ddCourses.Visible       = false;
                btnSaveToOSBLE.Visible  = false;
                lblLastSave.Label       = "No courses were found for which you can enter grades";
            }
        }
Esempio n. 4
0
 public OSBLEStateEventArgs(bool success, string message, OSBLEState state)
 {
     m_message = message;
     m_success = success;
     m_state   = state;
 }