/// <summary> /// Grab weatherinfo from DayHandler /// </summary> /// <returns>return said weatherinfo</returns> public Weather WeatherInfo() { DayHandler currentDayObj = Days[CurrentDay]; List <Weather> _actualWeather = currentDayObj.weather.ToList(); Weather DayWeather = _actualWeather[0]; return(DayWeather); }
/// <summary> /// Use sunTimesParser methods to grab appropriate times from our DayHandler object /// </summary> /// <returns>List of 2 datetime strings</returns> public List <string> createTimes() { List <string> timesList = new List <string>(); DayHandler currentDayObj = DayInfo(); timesList.Add($"{sunTimesParser(currentDayObj.sunrise)}A.M."); timesList.Add($"{sunTimesParser(currentDayObj.sunset)}P.M."); return(timesList); }
/// <summary> /// Parses Selected DayHandler Object /// </summary> /// <returns>Returns ordered Actual Temp List</returns> public List <string> Actuals_SliderParser() { DayHandler currentDayObj = DayInfo(); Temp _actualTemp = currentDayObj.temp; List <string> _iterableActuals = new List <string>(); _iterableActuals.Add(Convert.ToInt32(_actualTemp.morn).ToString()); _iterableActuals.Add(Convert.ToInt32(_actualTemp.day).ToString()); _iterableActuals.Add(Convert.ToInt32(_actualTemp.eve).ToString()); _iterableActuals.Add(Convert.ToInt32(_actualTemp.night).ToString()); return(_iterableActuals); }
/// <summary> /// Parses Selected DayHandler Object /// </summary> /// <returns>Returns ordered Feels_Like Temp List</returns> public List <string> Feels_SliderParser() { DayHandler currentDayObj = DayInfo(); FeelsLike _feelsLikeObj = currentDayObj.feels_like; List <string> _iterableFeelsLike = new List <string>(); _iterableFeelsLike.Add(Convert.ToInt32(_feelsLikeObj.morn).ToString()); _iterableFeelsLike.Add(Convert.ToInt32(_feelsLikeObj.day).ToString()); _iterableFeelsLike.Add(Convert.ToInt32(_feelsLikeObj.eve).ToString()); _iterableFeelsLike.Add(Convert.ToInt32(_feelsLikeObj.night).ToString()); return(_iterableFeelsLike); }
/// <summary> /// Async method to initiate App json connection from APIobj method /// </summary> //private async void InitializeConnection() //{ // await APIobj.connectToAPI(); //} /// <summary> /// SUPER UI method to update every needed weather display item and call APIobj methods to retrieve data for display /// /// TODO: Fix Icon image updating /// NOTE: Alot of these string format returns should be moved to APIobj class /// </summary> private void updateUI(bool iconUpdate) { string measurementChoice; bool imperialChoice = Preferences.Get("setting_Imperial", false); if (imperialChoice == false) { measurementChoice = "C"; } else { measurementChoice = "F"; } //TODO: Many of these display string will need to be formatted or parsed differently for the user List <string> sliderList_Actual = APIobj.Actuals_SliderParser(); List <string> sliderList_Feels = APIobj.Feels_SliderParser(); List <string> sunTimes = APIobj.createTimes(); Weather weatherInfo = APIobj.WeatherInfo(); DayHandler CurrentDayObject = APIobj.DayInfo(); if (iconUpdate == true) { weatherIcon.Source = APIobj.returnIcon(); } display_rainChance.Text = $"{CurrentDayObject.pop}%"; display_tempMax.Text = $"{Convert.ToInt32(CurrentDayObject.temp.max)}\x00B0{measurementChoice}"; //Remember temperatures change to implement preference choice display_tempMin.Text = $"{Convert.ToInt32(CurrentDayObject.temp.min)}\x00B0{measurementChoice}"; // display_ActualTemp.Text = $"{sliderList_Actual[sliderVal]}\x00B0{measurementChoice}"; //as noted above display_FeelsLike.Text = $"{sliderList_Feels[sliderVal]}\x00B0{measurementChoice}"; // display_WeatherMain.Text = $"{weatherInfo.main},"; display_WeatherDescript.Text = weatherInfo.description; display_WindSpeed.Text = CurrentDayObject.wind_speed.ToString(); display_WindDirection.Text = CurrentDayObject.wind_deg.ToString(); display_Humidity.Text = CurrentDayObject.humidity.ToString(); display_Pressure.Text = CurrentDayObject.pressure.ToString(); display_Sunrise.Text = sunTimes[0]; display_Sunset.Text = sunTimes[1]; string currentText; if (EnumDayInt == InitialDayInt) { currentText = "Currently\n"; } else { currentText = ""; } selected_day.Text = $"{currentText}{fetchDay("")}"; btn_minusDay.Text = fetchDay("minus").Substring(0, 3); btn_plusDay.Text = fetchDay("plus").Substring(0, 3); }