public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { PlaceAutocompleteAPI_Prediction selectedProduct = resultsTableController.FilteredPredictions [indexPath.Row]; ShowLoadingView("Getting location details ..."); Task runSync = Task.Factory.StartNew(async(object inputObj) => { var placeId = inputObj != null ? inputObj.ToString() : ""; if (!String.IsNullOrEmpty(placeId)) { var data = await AppData.GetPlaceDetails(placeId); InvokeOnMainThread(() => { if (IsPickUpLocation) { Facade.Instance.CurrentRide.PickUpData = data; } else { Facade.Instance.CurrentRide.DropOffData = data; } thisController.PopViewController(true); }); } HideLoadingView(); }, selectedProduct.place_id).Unwrap(); }
private void SelectedLocation(object sender, AdapterView.ItemClickEventArgs e) { PlaceAutocompleteAPI_Prediction selectedProduct = listData[e.Position]; ShowLoadingView("Getting location details ..."); Task runSync = Task.Factory.StartNew(async(object inputObj) => { var placeId = inputObj != null ? inputObj.ToString() : ""; if (!String.IsNullOrEmpty(placeId)) { var data = await AppData.GetPlaceDetails(placeId); string IsPickUpLocation = Intent.GetStringExtra("IsPickupLocation"); RunOnUiThread(() => { if (IsPickUpLocation == "true") { Facade.Instance.CurrentRide.PickUpData = data; } else { Facade.Instance.CurrentRide.DropOffData = data; } OnBack(); }); } HideLoadingView(); }, selectedProduct.place_id).Unwrap(); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { PlaceAutocompleteAPI_Prediction prediction = FilteredPredictions [indexPath.Row]; UITableViewCell reusableCell = tableView.DequeueReusableCell(cellIdentifier); var cellStyle = UITableViewCellStyle.Default; UITableViewCell cell = reusableCell ?? new UITableViewCell(cellStyle, cellIdentifier); ConfigureCell(cellStyle, cell, prediction, indexPath.Row); return(cell); }
protected void ConfigureCell(UITableViewCellStyle style, UITableViewCell cell, PlaceAutocompleteAPI_Prediction prediction, int idx) { if (cell != null) { switch (style) { case UITableViewCellStyle.Default: cell.TextLabel.Font = UIFont.FromName("Helvetica Light", 14); cell.TextLabel.AdjustsFontSizeToFitWidth = true; // gets smaller if it doesn't fit cell.TextLabel.MinimumFontSize = 12f; // never gets smaller than this size cell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap; cell.TextLabel.Text = prediction.description; break; case UITableViewCellStyle.Subtitle: cell.TextLabel.Font = UIFont.FromName("Helvetica Light", 14); cell.TextLabel.AdjustsFontSizeToFitWidth = true; // gets smaller if it doesn't fit cell.TextLabel.MinimumFontSize = 12f; // never gets smaller than this size cell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap; cell.TextLabel.Text = prediction.description; cell.DetailTextLabel.Font = UIFont.FromName("Helvetica Light", 12); cell.DetailTextLabel.Text = String.Join(", ", prediction.types); break; } if (idx % 2 == 0) { cell.BackgroundColor = new UIColor(217.0f / 255.0f, 217.0f / 255.0f, 217.0f / 255.0f, 1.0f); } //string detailedStr = string.Format ("{0:C} | {1}", product.IntroPrice, product.YearIntroduced); //cell.DetailTextLabel.Text = detailedStr; } }