public void DisplayItinerary(Itinerary itinerary) { this.itineraryAdapter.Update(itinerary); this.tvNumberOfTransfers.Text = itinerary.GetNumberOfTransfers().ToString(); this.tvTotalWalk.Text = itinerary.GetWalkTime_min().ToString() + " min"; this.tvTotalTime.Text = itinerary.GetDuration_min().ToString() + " min"; this.tvTravel.Text = itinerary.GetStartDate().ToLocalTime().ToString("h:mm:ss tt, M/dd/yy"); }
public override View GetView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.Inflate(Resource.Layout.search_results_item, null); } Itinerary itinerary = GetItineraryAtPosition(position); DateTime startDate = itinerary.GetStartDate(); DateTime now = DateTime.Now; CancelView btnDelete = convertView.FindViewById <CancelView> (Resource.Id.search_result_item_btn_cancel); string dayDisplay = ""; string timeDisplay = startDate.ToLocalTime().ToString("h:mm tt"); string durationDisplay = itinerary.GetDuration_min() + " min"; string titleDisplay = itinerary.GetFirstAgencyName(); string subtitleDisplay = ""; btnDelete.Visibility = ViewStates.Gone; if (itinerary.legs.Count > 0) { Leg leg = itinerary.legs.ElementAt(itinerary.legs.Count - 1); subtitleDisplay = leg.agencyName; } if (now.Day == startDate.Day) { dayDisplay = "Today"; } else if (now.Day + 1 == startDate.Day) { dayDisplay = "Tomorrow"; } else { dayDisplay = startDate.ToString("M/dd/yy"); } TextView tvDay = convertView.FindViewById <TextView> (Resource.Id.search_result_item_tv_day); TextView tvTime = convertView.FindViewById <TextView> (Resource.Id.search_result_item_tv_time); TextView tvDuration = convertView.FindViewById <TextView> (Resource.Id.search_result_item_tv_duration); TextView tvTitle = convertView.FindViewById <TextView> (Resource.Id.search_result_item_tv_title); TextView tvSubtitle = convertView.FindViewById <TextView> (Resource.Id.search_result_item_tv_subtitle); tvDay.Text = dayDisplay; tvTime.Text = timeDisplay; tvDuration.Text = durationDisplay; tvTitle.Text = titleDisplay; tvSubtitle.Text = subtitleDisplay; return(convertView); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { if (indexPath.Row % 2 == 1) { //invisible row UITableViewCell cell = tableView.DequeueReusableCell("blankcell"); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "blankcell"); } cell.BackgroundColor = UIColor.Clear; cell.UserInteractionEnabled = false; return(cell); } else { TripTableCell cell = tableView.DequeueReusableCell(mCellIdentifier) as TripTableCell; if (cell == null) { cell = new TripTableCell(mCellIdentifier); } int index = indexPath.Row / 2; Itinerary itinerary = mSearchResult.itineraries [index]; string durationString = itinerary.GetDuration_min().ToString() + " min"; string stepString = itinerary.GetFirstAgencyName(); cell.UpdateCell(itinerary.GetStartDate().ToLocalTime(), stepString, durationString); cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; return(cell); } }