private async Task handleRecognizedSpeech(RecognizedSpeech recognizedSpeech) { switch (recognizedSpeech.Message) { case Message.HOME: showSite("http://localhost/home.html"); break; case Message.HELP: showSite("http://localhost/help.html"); break; case Message.TIME: showSite("http://localhost/time.html"); break; case Message.WEATHER: showSite("http://localhost/weather.html"); break; case Message.WEATHERFORECAST: showSite("http://localhost/weatherforecast.html"); break; case Message.LIGHT: showSite("http://localhost/light.html"); break; case Message.NEWS_SPORTS: showSite("http://localhost/news.html?Sports"); break; case Message.NEWS_BUSINESS: showSite("http://localhost/news.html?Business"); break; case Message.NEWS_ENTERTAINMENT: showSite("http://localhost/news.html?Entertainment"); break; case Message.NEWS_HEALTH: showSite("http://localhost/news.html?Health"); break; case Message.NEWS_SCIENCE: showSite("http://localhost/news.html?Science"); break; case Message.NEWS_TECHNOLOGY: showSite("http://localhost/news.html?Technology"); break; case Message.QUOTE: showSite("http://localhost/quote.html"); break; case Message.RELOAD: await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { mainPage.Browser.Refresh(); }); break; case Message.NAVIGATE_FOREWARDS: await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { if (mainPage.Browser.CanGoForward) { mainPage.Browser.GoForward(); } }); break; case Message.NAVIGATE_BACKWARDS: await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { if (mainPage.Browser.CanGoBack) { mainPage.Browser.GoBack(); } }); break; case Message.SCROLL_UP: await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { await mainPage.Browser.InvokeScriptAsync("eval", new[] { "window.scrollBy(0, 50);" }); }); break; case Message.SCROLL_DOWN: await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { await mainPage.Browser.InvokeScriptAsync("eval", new[] { "window.scrollBy(0, -50);" }); }); break; case Message.SPEECH_TIME: showSite("http://localhost/time.html"); await SpeechService.SayTime(); break; case Message.SPEECH_NAME: await SpeechService.SayName(); break; case Message.SPEECH_LOOK: await SpeechService.SayLook(); break; case Message.SPEECH_GENDER: await SpeechService.SayGender(); break; case Message.SPEECH_MIRROR: await SpeechService.SayMirror(); break; case Message.SPEECH_COUNT: int.TryParse(recognizedSpeech.SemanticText, out int count); await SpeechService.CountTo(count); break; case Message.SPEECH_COUNTDOWN: int.TryParse(recognizedSpeech.SemanticText, out int countdown); await SpeechService.CountDown(countdown); break; case Message.SPEECH_RANDOM: // TODO //await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => //{ // int.TryParse(recognizedSpeech.SemanticText.Split(' ')[0], out int from); // int.TryParse(recognizedSpeech.SemanticText.Split(' ')[1], out int to); // //await mainPage.SpeechService.SayRandom(from, to); //}); //break; case Message.SPEECH_JOKE: await SpeechService.SayJoke(); break; case Message.SPEECH_QUOTE: showSite("http://localhost/quote.html"); await SpeechService.SayQuote(); break; case Message.SPEECH_WEATHER: showSite("http://localhost/weather.html"); await SpeechService.SayWeather(); break; case Message.SPEECH_CREATOR: await SpeechService.SayCreator(); break; case Message.SPEECH_WEATHERFORECAST: showSite("http://localhost/weatherforecast.html"); await SpeechService.SayWeatherforecast(recognizedSpeech.SemanticText.Split(' ')[1]); break; case Message.SPEECH_WEATHER_TEMPERATURE: //TODO break; case Message.SPEECH_SUNRISE: await SpeechService.SaySunrise(); break; case Message.SPEECH_SUNSET: await SpeechService.SaySunset(); break; case Message.POWER: await RaspberryPiGpio.RaspberryPiGpio.TriggerOnOffButton(); break; case Message.UNKNOWN: break; } }