public Day(int daysLeft, int currentDay) { //Forecast = new Weather(daysLeft, currentDay); Weather = new RealWeather(); customers = new List <Customer>(); sevenDayForecast = new int[daysLeft]; numberGenerator = new Random(); GenerateWeather(currentDay); CreateMonkeys(); SevenDayForecastGetter(daysLeft, currentDay); GetDailyWeather(currentDay); }
public void GenerateWeather(int currentDay) { string strurltest = "https://api.darksky.net/forecast/776a8b1c0ed27586644bc263c3652fb7/43.035,-87.9225?exclude=minutely,hourly,alerts,flags"; WebRequest requestObject = WebRequest.Create(strurltest); requestObject.Method = "GET"; HttpWebResponse responseObject = null; responseObject = (HttpWebResponse)requestObject.GetResponse(); string strresulttest = null; using (Stream stream = responseObject.GetResponseStream()) { StreamReader sr = new StreamReader(stream); strresulttest = sr.ReadToEnd(); sr.Close(); } Weather = JsonConvert.DeserializeObject <RealWeather>(strresulttest); }