public void voiceControlHandler(String command) { SpokenCommand result; String response; if (recognizer.Commands.TryGetValue(command, out result)) { ArmCommander.loadAndStart(result); result.executeFurtherActions(out response); if (response != null) { synth.SpeakAsync(response); } } }
public void voiceControlHandler(String command) { if (command == "Ok llarvis, abre la presentación") { synth.SpeakAsync("Abriendo la presentación"); var app = new Microsoft.Office.Interop.PowerPoint.Application(); var pres = app.Presentations; var file = pres.Open(@"C:\Users\Gregorio\Documents\Curso 2013-2014\Presentación institutos\Por qué estudiar ingeniería.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse); Slides slides = file.Slides; Microsoft.Office.Interop.PowerPoint.SlideShowSettings objSSS; //Run the Slide show objSSS = file.SlideShowSettings; objSSS.Run(); } if (command == "Ok llarvis, muestra la ventana") { this.Dispatcher.BeginInvoke((Action) delegate { ShowWindow(); }); synth.SpeakAsync("Mostrando ventana"); } if (command == "Ok llarvis, minimiza la ventana") { this.Dispatcher.BeginInvoke((Action) delegate { HideWindow(); }); synth.SpeakAsync("Minimizando ventana"); } SpokenCommand result; String response; if (recognizer.Commands.TryGetValue(command, out result)) { ArmCommander.loadAndStart(result); result.executeFurtherActions(out response); if (response != null) { synth.SpeakAsync(response); } } }