Beispiel #1
0
        private void TextBoxDisplay_Config(string promptText)
        {
            promptText.Text2Speech(3, false);
            PromptLineRichTextBox.AppendText(promptText + " ");
            PromptLineRichTextBox.ScrollToBottom();

            var tmp_exp = Gcide.GetMeaning(promptText);

            ExplanationRichTextBox.Text = tmp_exp;
            //ExplanationRichTextBox1.ColorWord(tmp_exp, Color.DarkOrange, 0);
            ExplanationRichTextBox.ColorWord(promptText, Color.Black, 0);
            //  ExplanationRichTextBox1.ColorWord(Gcide.GetPhoonetic(promptText), Color.Green, 0);
            //promptRichTextBox.Text = promptText;
            var pos = new List <string>(new string[]
            {
                "noun", "pronoun", "verb", "adjective", "adverb",
                "preposition", "conjunction", "interjection"
            });

            foreach (string p in pos)
            {
                ExplanationRichTextBox.ColorWord(p, Color.DarkCyan, 0);
            }
            var num    = new List <string>();
            var no_max = 20;

            for (int i = 0; i < no_max; i++)
            {
                num.Add(Convert.ToString(i));
            }

            foreach (string n in num)
            {
                ExplanationRichTextBox.ColorWord(n, Color.MediumBlue, 0);
            }
        }
Beispiel #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 = PromptLineRichTextBox.Text.IndexOf(wd, StringComparison.CurrentCulture);
                if (inputText.Length <= Prompts[currentPrompt].Length && inputText.Length > 0)
                {
                    PromptLineRichTextBox.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)
                    {
                        PromptLineRichTextBox.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
                    {
                        PromptLineRichTextBox.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)
                {
                    PromptLineRichTextBox.ColorChar(idx, 1, Color.Gray);
                }
            }
            else
            {
                rightInput += inputText;
                CurrentChar[currentPrompt]++;
                if (currentPrompt < MAX_PROMPTS - 1)
                {
                    ShowNextPrompt();
                }
                else if (currentPrompt == MAX_PROMPTS - 1)
                {
                    ShowFinalScreen();
                }
            }
        }