Пример #1
0
        private void ProcessLogin()
        {
            if (this.txtUsername.Text == string.Empty || this.txtPassword.Text == string.Empty)
            {
                MessageBox.Show(this, "Please enter your credentials", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                var registrationPrefix = System.Configuration.ConfigurationManager.AppSettings["registration_prefix"];
                if (this.txtPassword.Text == this.txtUsername.Text && this.txtUsername.Text.StartsWith(registrationPrefix))
                {
                    SpeedDataHandler.GetInstance().SetupUser(this.txtUsername.Text);
                    SpeedDataHandler.GetInstance().SetupEnvironment();

                    this.Hide();

                    User user = new User();
                    user.RegisterNumber = this.txtUsername.Text;

                    new Picker(user).ShowDialog();

                    this.Close();
                }
                else
                {
                    MessageBox.Show(this, "Invalid Register Number or password", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #2
0
        private void LoadSpeeds()
        {
            List <Speed> speeds = SpeedDataHandler.GetInstance().LoadSpeeds(this.currentSession.Language, this.currentSession.Stream);

            this.cmbSpeed.DataSource    = speeds;
            this.cmbSpeed.DisplayMember = "Name";
        }
Пример #3
0
        private void SetIntervalDataSource()
        {
            List <Intervals> intervals = SpeedDataHandler.GetInstance().GetSpeedIntervals();

            this.cmbTime.DataSource    = intervals;
            this.cmbTime.SelectedItem  = intervals[1];
            this.cmbTime.DisplayMember = "Name";
        }
Пример #4
0
        private void cmbSpeed_SelectedIndexChanged(object sender, EventArgs e)
        {
            Speed speed = (Speed)cmbSpeed.SelectedItem;

            speed = SpeedDataHandler.GetInstance().LoadSpeedMetaData(speed);
            speed.WordsPerMinute = speed.Words / this.currentSession.Interval.Interval;

            this.txtParagraph.Text      = speed.Paragraphs.ToString();
            this.txtSentence.Text       = speed.Sentences.ToString();
            this.txtWords.Text          = speed.Words.ToString();
            this.txtCharacters.Text     = speed.Characters.ToString();
            this.txtWhiteSpace.Text     = speed.Spaces.ToString();
            this.txtWordsPerMinute.Text = speed.WordsPerMinute.ToString();

            this.rTxtSpeed.Text = speed.SpeedText;

            this.currentSession.Speed = speed;
        }