Example #1
0
        private void btnPlay_Click(object sender, EventArgs e)
        {
            CopyScreen.PerformClick();

            stopbtn.PerformClick();
            btnPlay.Enabled  = false;
            btnPause.Enabled = true;
            //CopyScreen.PerformClick();
            george.SpeakAsync(convertedtxt.Text);
        }
 private void btnPlay_Click(object sender, EventArgs e)
 {
     CopyScreen.PerformClick();
     if (cbVoice.SelectedIndex >= 0)
     {
         stopbtn.PerformClick();
         btnPlay.Enabled  = false;
         btnPause.Enabled = true;
         //CopyScreen.PerformClick();
         Marvel.SpeakAsync(convertedtxt.Text);
     }
     else
     {
         Marvel.Speak("Please select a voice for reading");
         cbVoice.Focus();
     }
 }
        /// <summary>
        /// Handles the SpeechRecognized event of the engine control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Speech.Recognition.SpeechRecognizedEventArgs"/> instance containing the event data.</param>
        void engine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            //inputtxt.Text = getKnownTextOrExecute(e.Result.Text);
            string speech = (e.Result.Text);

            switch (speech)
            {
            //GREETINGS
            case "start reading":
                CopyScreen.PerformClick();
                btnPlay.PerformClick();
                break;

            case "read the result":
            case "read the results":
            case "whats the results":
            case "whats the result":
            case "what is the result":
                GetResult();
                break;

            case "search":
                convertbtn.PerformClick();
                break;

            case "pause":
                btnPause.PerformClick();
                break;

            case "resume":
                btnPause.PerformClick();
                break;

            case "stop":
                stopbtn.PerformClick();
                break;

            case "close website search":
                closebtn.PerformClick();
                break;

            case "hide website reader":
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Minimized;
                TopMost         = false;
                break;

            case "show website reader":
            case "show website reader again":
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Normal;
                TopMost         = true;
                break;

            case "change voice to brian":
                //cbVoice.SelectedIndex = 0;
                if (cbVoice.Text != "IVONA 2 Brian OEM")
                {
                    cbVoice.SelectedItem = "IVONA 2 Brian OEM";
                    Marvel.SelectVoice("IVONA 2 Brian OEM");
                }
                else
                {
                    cbVoice.SelectedItem = "Microsoft David Desktop";
                    Marvel.SelectVoice("Microsoft David Desktop");
                    Marvel.Speak("ivona 2 brian is, not installed, here is microsoft david desktop, at your service");
                }
                break;

            case "change voice to salli":
                if (cbVoice.Text != "IVONA 2 Salli OEM")
                {
                    cbVoice.SelectedItem = "IVONA 2 Salli OEM";
                    Marvel.SelectVoice("IVONA 2 Salli OEM");
                }
                else
                {
                    cbVoice.SelectedItem = "Microsoft Zira Desktop";
                    Marvel.SelectVoice("Microsoft Zira Desktop");
                    Marvel.Speak("Ivona salli, is not installed, here is microsoft zira desktop, at your service");
                }
                break;

            case "change voice to microsoft devid":
                //cbVoice.SelectedIndex = 0;
                //computer.SelectVoice(cbVoice.Text);
                cbVoice.SelectedItem = "Microsoft David Desktop";
                Marvel.SelectVoice("Microsoft David Desktop");
                break;

            case "change voice to amy":
                if (cbVoice.Text != "IVONA 2 Amy OEM")
                {
                    cbVoice.SelectedItem = "IVONA 2 Amy OEM";
                    Marvel.SelectVoice("IVONA 2 Amy OEM");
                }
                else
                {
                    cbVoice.SelectedItem = "Microsoft Zira Desktop";
                    Marvel.SelectVoice("Microsoft Zira Desktop");
                    Marvel.Speak("Ivona amy, is not installed, here is microsoft zira desktop, at your service");
                }
                break;

            case "change voice to microsoft zira":
                //cbVoice.SelectedIndex = 2;
                //computer.SelectVoice(cbVoice.Text);
                cbVoice.SelectedItem = "Microsoft Zira Desktop";
                Marvel.SelectVoice("Microsoft Zira Desktop");
                break;
            }
        }