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; } } }
private static void speakWeather(Mouth mouth, Interpreter interpreter, OWMForecast oWMForecast, OWMCurrent oWM) { ForecastData fc = oWMForecast.ForeCastWeahterData("cv5", "GB", "Coventry", 1); try { //var returned = oWM.GetCurrent("cv5", "GB", "Coventry", 1); var returned = oWM.GetCurrent("cv5", "GB", "Coventry", 2); mouth.speakMsg(string.Format(interpreter.CurrentSummary(returned))); } catch (Exception e) { Console.WriteLine(e.Message); } mouth.speakMsg(interpreter.ForecastSummary(fc)); }