private void speakNews(Mouth mouth, Interpreter interpreter, NewsApiTop newsAPI) { TopNews data = newsAPI.GetTopNews("gb"); mouth.speakMsg(string.Format("The top 5 news stories today are:")); foreach (string story in interpreter.Top5(data)) { mouth.speakMsg(string.Format(story)); } }
private void speakWeather(Mouth mouth, Interpreter interpreter, OWMForecast oWMForecast, OWMCurrent oWM) { try { ForecastData fc = oWMForecast.ForeCastWeahterData("cvk.jk5", "GB", "Coventry", 2); var returned = oWM.GetCurrent("cv5", "GB", "Coventry", 2); mouth.speakMsg(string.Format(interpreter.CurrentSummary(returned))); mouth.speakMsg(interpreter.ForecastSummary(fc)); } catch (Exception e) { Console.WriteLine(e.Message); MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }