コード例 #1
0
        private void tsmi_Start_Click(object sender, EventArgs e)
        {
            //if (this.currentProfile.Dialogue.Enabled)
            //{
            //    try
            //    {
            //        this.dialogueWatcher.EnableRaisingEvents = true;
            //    }
            //    catch (ArgumentException ex)
            //    {
            //        Console.WriteLine(String.Format("The dialogue file path,'{0}', is invalid!", this.dialogueWatcher.Path));
            //    }
            //}

            this.tb_RecognizedWord.BackColor = Color.LightGreen;
            if (engine != null)
                engine.Dispose();

            if (this.currentProfile.Actions.Count == 0)
                engine = new DialogueRecognitionEngine();
            else
                engine = new DialogueRecognitionEngine(this.currentProfile);
            engine.onWordRecognized += this.AddRecognizedText;

            if (!this.engine.Running)
                engine.StartAsync(sp.RecognizeMode.Multiple);
        }
コード例 #2
0
        private void tsmi_emulateActivePhrase_Click(object sender, EventArgs e)
        {
            if (this.CurrentPhrase != null)
            {
                this.tb_RecognizedWord.BackColor = Color.Yellow;
                Application.DoEvents();
                System.Threading.Thread.Sleep(2000);

                if (engine != null)
                    engine.Dispose();

                engine = new DialogueRecognitionEngine(this.currentProfile);
                engine.onWordRecognized += this.AddRecognizedText;

                if (!this.engine.Running)
                    engine.EmulateRecognize(this.CurrentPhrase);
                this.tb_RecognizedWord.BackColor = SystemColors.Control;
                this.engine.Stop();
                this.tb_RecognizedWord.Text = string.Empty;
            }
        }