private static 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)); } }
static void MainLoop() { reader keyreader = new reader(); string[] keys = keyreader.ReadKeys(); NewsApiTop newsAPI = new NewsApiTop(keys[0]); OWMForecast oWMForecast = new OWMForecast(keys[1]); OWMCurrent oWM = new OWMCurrent(keys[1]); Interpreter interpreter = new Interpreter(); while (true) { string intext = ""; Console.Write("Press 1 for Full Update, 2 for news, 3 for weather \t"); intext = Console.ReadLine(); switch (intext) { default: break; case "1": speakNews(m, interpreter, newsAPI); speakWeather(m, interpreter, oWMForecast, oWM); break; case "2": speakNews(m, interpreter, newsAPI); break; case "3": speakWeather(m, interpreter, oWMForecast, oWM); break; } } }