private void UpdateWeatherUI() { WeekDayLabel.Text = dayViewViewModel.Date; TimeLabel.Text = dayViewViewModel.Time; TimezoneInfoLabel.Text = dayViewViewModel.TimezoneInfo; Temp1Label.Text = dayViewViewModel.Temperature; Humid1Label.Text = dayViewViewModel.Humidity; Speed1Label.Text = dayViewViewModel.WindSpeed; SummaryLabel.Text = dayViewViewModel.Summary; IconImage.Image = dayViewViewModel.Image; CurrentLocationButton.SetTitle(dayViewViewModel.CurrentLocation, UIControlState.Normal); Debug.WriteLine("RootViewController: Weather data UI updated."); Debug.WriteLine("Weather Time: {0}, Timezone: {1}, UnixTime: {2}", dayViewViewModel.Time, dayViewViewModel.TimeZone, dayViewViewModel.UnixTime); Debug.WriteLine(String.Format("(Weather Timezone Time: {0})", dayViewViewModel.TimezoneTime)); //update cached Weather Day Data array if (weekViewViewModel.NumberOfDays > 0) { // update table view WeekTableView.Source = new RootTableSource(weatherDayDataArray); WeekTableView.ReloadData(); ScrollToRow(0, 0, false); } }
private void ScrollToRow(int itemIndex, int sectionIndex, bool animated) { if (weekViewViewModel.NumberOfDays > 0) { var indexPath = NSIndexPath.FromItemSection(itemIndex, sectionIndex); WeekTableView.ScrollToRow(indexPath, UITableViewScrollPosition.Top, animated); } }