private void TemperatureText(List <TimeSery> series) { foreach (var ts in series) { DateTime parsedTime = Convert.ToDateTime(ts.validTime); var timeOfDay = parsedTime.TimeOfDay; if (timeOfDay == morning) { ForecastParameters parameters = new ForecastParameters(ts); var temp = parameters.AirTemperature; //C°", TextView.BufferType.Normal, tableRow); var weatherSymbol = WeatherSymbol.WeatherSymbolDictionary[parameters.WeatherSymbol]; var minPrecipitation = parameters.MinimumPrecipitationIntensity; var maxPrecipitation = parameters.MaximumPrecipitationIntensity; var windDirection = parameters.WindDirection; var windSpeed = parameters.WindSpeed; var windGustSpeed = parameters.WindGustSpeed; } //else if (timeOfDay == day) //{ // ForecastParameters parameters = new ForecastParameters(timeSerie) //} //else if (timeOfDay == evening) //{ // ForecastParameters parameters = new ForecastParameters(timeSerie) //} } }
/* public void GridViewPresentation() * { * GridLayout layout = FindViewById<GridLayout>(Resource.Id.gridLayout1); * * //Img * ImageView imgView = new ImageView(this); * GridLayout.LayoutParams param = new GridLayout.LayoutParams(); * param.Height = GridLayout.LayoutParams.WrapContent; * param.Width = GridLayout.LayoutParams.WrapContent; * param.SetMargins(5, 5, 5, 5); * param.SetGravity(Android.Views.GravityFlags.Center); * * //param.ColumnSpec = GridLayout.Spec; * //param.rowSpec = GridLayout.spec(r);; * imgView.LayoutParameters = param; * layout.AddView(imgView); * * //Time * TextView timeTextView = new TextView(this); * timeTextView.Text = "Test"; * GridLayout.LayoutParams param1 = new GridLayout.LayoutParams(); * param1.Height = GridLayout.LayoutParams.WrapContent; * param1.Width = GridLayout.LayoutParams.WrapContent; * param1.SetMargins(5, 5, 5, 5); * param1.SetGravity(Android.Views.GravityFlags.Center); * * timeTextView.LayoutParameters = param1; * layout.AddView(timeTextView); * * //Temp * * * //Wind * * * //precipitation * * * //Text * }*/ private void ShowProduct(ForeCast product) { //label1.Text = ($"Approved Time: {product.approvedTime}"); //label2.Text = ($"Reference Time: {product.referenceTime}"); //label3.Text = ($"Long: {product.geometry.coordinates[0][0]}"); //label4.Text = ($"Lat: {product.geometry.coordinates[0][1]}"); TableLayout tableLayout = FindViewById <TableLayout>(Resource.Id.tableLayout1); foreach (var timeSerie in product.timeSeries) { DateTime parsedTime = Convert.ToDateTime(timeSerie.validTime); TimeSpan start = TimeSpan.Parse("12:00"); if (parsedTime.TimeOfDay == start) { TableRow tableRow = new TableRow(this); var culture = new System.Globalization.CultureInfo("sv-SE"); var day = culture.DateTimeFormat.GetDayName(parsedTime.DayOfWeek).ToUpperInvariant(); // 23 Sat Saturday AddTextView($"{day}", TextView.BufferType.Normal, tableRow); //AddTextView($"Count: {timeSerie.parameters.Count}", TextView.BufferType.Normal, tableRow); ForecastParameters parameters = new ForecastParameters(timeSerie); var AirTemperature = timeSerie.parameters.FirstOrDefault(x => x.name == "t").values[0]; TextView AirTemperatureTv = new TextView(this); AddTextView($"{parameters.AirTemperature} C°", TextView.BufferType.Normal, tableRow); AddTextView($"{WeatherSymbol.WeatherSymbolDictionary[parameters.WeatherSymbol]}", TextView.BufferType.Normal, tableRow); AddTextView($"{parameters.MinimumPrecipitationIntensity} - {parameters.MaximumPrecipitationIntensity} mm", TextView.BufferType.Normal, tableRow); //AddTextView($"{parameters.WindDirection}", TextView.BufferType.Normal, tableRow); AddTextView($"{parameters.WindSpeed} m/s", TextView.BufferType.Normal, tableRow); AddTextView($"{parameters.WindGustSpeed}", TextView.BufferType.Normal, tableRow); //AddTextView($"{ PrecipitationCategory.PrecipitationCategoryDictionary[parameters.PrecipitationCategory]}", TextView.BufferType.Normal, tableRow); //label4.Text = ($"AirPressure: {parameters.AirPressure}"); // Console.WriteLine($"PrecipitationCategory: {PrecipitationCategory.PrecipitationCategoryDictionary[parameters.PrecipitationCategory]}"); //Console.WriteLine($"HorizontalVisibility: {parameters.HorizontalVisibility}"); //Console.WriteLine($"MeanValueOfHighLevelCloudCover: {parameters.MeanValueOfHighLevelCloudCover}"); //Console.WriteLine($"MeanValueOfLowLevelCloudCover: {parameters.MeanValueOfLowLevelCloudCover}"); //Console.WriteLine($"PercentOfPrecipitationInFrozenForm: {parameters.PercentOfPrecipitationInFrozenForm}"); //label1.Text = ($"RelativeHumidity: {parameters.RelativeHumidity}"); //Console.WriteLine($"ThunderProbability: {parameters.ThunderProbability}"); tableLayout.AddView(tableRow); } } }
public WeatherDataTest() { weatherRepository = new WeatherRepository(); forecastParameters = new ForecastParameters() { ApiKey = ApiKey, OptionalParameters = new OptionalParameters() { DataBlocksToExclude = new List <ExclusionBlocks>() { ExclusionBlocks.Alerts, ExclusionBlocks.Daily, ExclusionBlocks.Flags, ExclusionBlocks.Hourly, ExclusionBlocks.Minutely } }, Latitude = 51, Longitude = 14 }; }
public MainWindow() { InitializeComponent(); this.weatherService = new WeatherService(); this.optionalParameters = new OptionalParameters() { DataBlocksToExclude = new List <ExclusionBlocks>() { ExclusionBlocks.Alerts, ExclusionBlocks.Daily, ExclusionBlocks.Flags, ExclusionBlocks.Hourly, ExclusionBlocks.Minutely } }; this.convertedLatitudeLongitude = new Dictionary <string, double>() { { this.Latitude.Name, 0 }, { this.Longitude.Name, 0 } }; this.forecastParameters = new ForecastParameters(); }
/// <summary> /// Make a request to get forecast data. /// </summary> /// <param name="forecastParameters">Forecast parameters.</param> /// <returns>A DarkSkyResponse with the API headers and data.</returns> public Task <DarkSkyResponse> GetForecast(ForecastParameters forecastParameters) { return(weatherRepository.GetForecast(forecastParameters)); }