//metodo para o reconhecimento q private void rec(object s, SpeechRecognizedEventArgs e) { string speech = e.Result.Text; float conf = e.Result.Confidence; if (conf > 0.35f) { if (GrammarWord.JarvisSopListening.Any(x => x == speech)) { Speaker.Speak("Qual quer coisa me chame"); isJarvisListening = false; } else if (GrammarWord.JarvisStartListening.Any(x => x == speech)) { isJarvisListening = true; Speaker.Speak("Estou ouvindo", "Diga o que quer "); } if (isJarvisListening == true) { switch (e.Result.Grammar.Name) { case "sys": //compara com a tabela if (GrammarWord.WhatTimeIs.Any(x => x == speech)) { Runner.WhatTimesIs(); } else if (GrammarWord.OpenBrowser.Any(x => x == speech)) { Runner.OpenBrowser(); } else if (GrammarWord.WhatDataIs.Any(x => x == speech)) { Runner.WhatDataIs(); } else if (GrammarWord.AbrirNotas.Any(x => x == speech)) { Runner.AbirNota(); } else if (GrammarWord.FecharNotas.Any(x => x == speech)) { Runner.FecharNotas(); } else if (GrammarWord.MinimizarWindow.Any(x => x == speech)) { MinimizeWindow(); } else if (GrammarWord.MaximizarWindow.Any(x => x == speech)) { MaximizarWindow(); } else if (GrammarWord.NormalWindow.Any(x => x == speech)) { NormalWindow(); } else if (GrammarWord.PesquisaGoogle.Any(x => x == speech)) { Runner.PesquisaGoogle(); } else if (GrammarWord.FecharGoogle.Any(x => x == speech)) { Speaker.Speak("Fechando"); Runner.FecharGoogle(); } break; } } } }
private void Form1_Load(object sender, EventArgs e) { LoadSpeech(); Speaker.Speak("Diga o que quer!", "Como posso ajudar"); }