Example #1
0
        private void SetTextBox()
        {
            Random rnd = new Random();

            try
            {
                for (int i = 0; i < 50; i++)
                {
                    //generate random index from 0-1000
                    int r = rnd.Next(textFieldArr.Length);

                    //if temptext does not already contain word, add to temptext
                    if (!tempText.Contains(textFieldArr[r]))
                    {
                        tempText += textFieldArr[r] + " ";
                    }
                }
                SetGetText.SetText(mainText, tempText);
            }
            catch (IndexOutOfRangeException ex)
            {
                Debug.WriteLine("{0} Exception caught.", ex);
            }

            String getMainText = SetGetText.GetText(mainText);

            checkInputArr = getMainText.Split(" ");
        }
Example #2
0
        public void Refresh()
        {
            tempText           = "";
            entryBox.IsEnabled = true;
            entryBox.Text      = String.Empty;
            entryBox.Focus();
            SetGetText.SetText(mainText, "");
            SetTextBox();

            //reset current typing records
            correctWords     = 0;
            accuracy         = 0;
            currentWordIndex = 0;
            wpm = 0;

            //empty labels
            accNum.Content = String.Empty;
            wpmNum.Content = String.Empty;
        }