示例#1
0
 private void TextBoxDisplay_Config(string promptText)
 {
     promptText.Text2Speech(3, false);
     PromptRichTextBox.AppendText(promptText + " ");
     PromptRichTextBox.ScrollToBottom();
 }
示例#2
0
        private void inputRichTextBox_TextChanged(object sender, EventArgs e)
        {
            var inputText = InputRichTextBox.Text;
            var wd        = Prompts[currentPrompt];

            //when we hit the end of a prompt, switch to the next prompt
            if (inputText.Length == wd.Length)
            {
                if (object.Equals(wd, inputText))
                {
                    _stats.Update(true);
                }
                else
                {
                    _stats.Update(false);
                }
            }
            else
            {
            }


            if (InputRichTextBox.Text.Contains(Prompts[currentPrompt]) == false)
            {
                var idx = PromptRichTextBox.Text.IndexOf(wd, StringComparison.CurrentCulture);
                if (inputText.Length <= Prompts[currentPrompt].Length && inputText.Length > 0)
                {
                    PromptRichTextBox.ColorChar(idx + inputText.Length - 1, wd.Length -
                                                inputText.Length + 1, Color.Gray);
                    var in_ch    = inputText[inputText.Length - 1];
                    var right_ch = Prompts[currentPrompt][inputText.Length - 1];
                    if (in_ch == right_ch)
                    {
                        PromptRichTextBox.ColorChar(idx + inputText.Length - 1, 1, Color.Gray);
                        InputRichTextBox.ColorChar(inputText.Length - 1, 1, Color.Gray);
                        "audio//sys//type.wav".PlayWave(Properties.Settings.Default.type_effect);
                    }
                    else
                    {
                        PromptRichTextBox.ColorChar(idx + inputText.Length - 1, 1, Color.Red);
                        InputRichTextBox.ColorChar(inputText.Length - 1, 1, Color.Red);
                        "audio//sys//error.wav".PlayWave(Properties.Settings.Default.type_effect);
                    }
                }
                else if (inputText.Length > Prompts[currentPrompt].Length)
                {
                    InputRichTextBox.ColorChar(inputText.Length - 1, 1, Color.Red);


                    "audio//sys//error.wav".PlayWave(Properties.Settings.Default.type_effect);
                }
                else if (inputText.Length == 0)
                {
                    PromptRichTextBox.ColorChar(idx, 1, Color.Gray);
                }
            }
            else
            {
                rightInput += inputText;
                CurrentChar[currentPrompt]++;
                if (currentPrompt < MAX_PROMPTS - 1)
                {
                    ShowNextPrompt();
                }
                else if (currentPrompt == MAX_PROMPTS - 1)
                {
                    ShowFinalScreen();
                }
            }
        }