public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); propertyManager = new PropertyMangager(); if (currentPropertyId > 0) { propertyDetail = propertyManager.GetItemAsync(currentPropertyId.ToString()).Result; byte[] imageBytes = null; imageBytes = propertyManager.GetImageAsync(propertyDetail.Image).Result; //ImageHelper.SetImage(imageBytes, propertyDetail.ListingID, PropertyImage, 150); ImageHelper.SetImage(propertyManager, propertyDetail.ListingID, propertyDetail.Image, PropertyImage); AddressLabel.Text = propertyDetail.Address; BedsLabel.Text = string.Format("Beds: {0}", propertyDetail.Beds); BathsLabel.Text = string.Format(", Baths: {0}", propertyDetail.Baths); EstimatedValueLabel.Text = string.Format(", {0:C}, ", propertyDetail.EstimatedValue); RateChangeLabel.Text = string.Format("{0}%", Convert.ToString(propertyDetail.ChangeOverLastYear)); FeatureText.Text = propertyDetail.Features; if (Convert.ToDouble(propertyDetail.ChangeOverLastYear) < 0) { RateChangeLabel.TextColor = UIColor.Red; } } }
/// <summary> /// OnCreate /// </summary> /// <param name="savedInstanceState"></param> protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); progress = ProgressDialog.Show(this, "Loading", "Please Wait...", true); //propertyManager = TinyIoC.TinyIoCContainer.Current.Resolve<IPropertyMangager>(); propertyManager = Mvx.GetSingleton <IPropertyMangager>(); // propertyManager = new PropertyMangager(); int listingID = Intent.GetIntExtra("ListingID", 0); if (listingID > 0) { propertydetail = await propertyManager.GetItemAsync(listingID.ToString()); } SetContentView(Resource.Layout.PropertyDetailView); if (propertydetail != null) { BindFields(); } if (CrossConnectivity.Current.IsConnected) { SQLLiteHelper.InsertPropertyDetails(propertydetail); } if (progress != null) { progress.Hide(); } }
public void TestGetItemAsync() { Task.Run(async() => { var listDetail = await mgr.GetItemAsync("1"); Assert.IsNotNull(listDetail); } ).GetAwaiter().GetResult(); }