>>>Mi piacerebbe creare un'applicazione che riconosca la voce.
private void RunRecognitionEngine(CultureInfo c)
{
eng = new Microsoft.Speech.Recognition.SpeechRecognitionEngine(c);
var list = SpeechRecognitionEngine.InstalledRecognizers();
Choices parole = new Choices();
parole.Add(new string[] {"comando naviga","comando articoli","leggi","ferma","parti","precedente","fuori","dentro"});
// Create a GrammarBuilder object and append the Choices object.
GrammarBuilder gb = new GrammarBuilder();
gb.Append(parole);
// Create the Grammar instance and load it into the speech recognition engine.
Grammar g = new Grammar(gb);
eng.LoadGrammar(g);
eng.SetInputToDefaultAudioDevice();
eng.RecognizeAsync(RecognizeMode.Multiple);
// Register a handler for the SpeechRecognized event.
eng.SpeechRecognized += Recognizer_SpeechRecognized2;
}
private void Recognizer_SpeechRecognized2(object sender, SpeechRecognizedEventArgs e)
{
if (e.Result.Text.Equals("naviga"))
{
this.StopReading();
if(this.lastHrefLink!=null && this.lastHrefLink !="") {
this.Navigate(this.lastHrefLink);
}
}
if(e.Result.Text.Equals("articoli"))
{
this.StopReading();
HtmlElementCollection coll = doc.All;
StartReadingArticleTimer();
LeggiArticoli(coll);
}
if(e.Result.Text.Equals("leggi"))
{
this.fermaLetturaArticoli = false;
this.StartReading();
}
if (e.Result.Text.Equals("ferma"))
{
this.fermaLetturaArticoli = true;
this.StopReading();
}
}
lascia perdere i metodi dentro gli if ,se traduci in vb.net dovrebbe comunque riconoscere le parole (Choices)