public SelectedItemPage(House selectedHouse) { InitializeComponent(); resultPageStackView.Padding = new Thickness(10, 20, 10, 4); houseImage.Source = selectedHouse.Image; houseImage.HeightRequest = 175; var selectedHouseUrl = basicInfoUrl + selectedHouse.ListingID; var taskReadJSON = Task.Run( async() => { var result = await JSONDownloader.DownloadSerializedJSONDataAsync <House> (selectedHouseUrl); selectedHouse = result; }); taskReadJSON.Wait(); pageTitle.Text = selectedHouse.Address; numberOfBeds.Text = "Beds: " + selectedHouse.Beds + ","; numberOfBeds.FontSize = 10; numberOfBaths.Text = "Baths: " + selectedHouse.Baths + ","; numberOfBaths.FontSize = 10; houseAddress.Text = selectedHouse.Address; houseAddress.FontSize = 10; ChangeOverLastYear.Text = selectedHouse.ChangeOverLastYear + "%"; Double changeOverlastYearTemp = Double.Parse(selectedHouse.ChangeOverLastYear); ChangeOverLastYear.FontSize = 10; if (changeOverlastYearTemp < 0) { ChangeOverLastYear.TextColor = Color.Red; } else { ChangeOverLastYear.TextColor = Color.Green; } houseFeatures.Text = selectedHouse.Features; houseFeatures.FontSize = 10; houseEstimatedValue.Text = "$" + selectedHouse.EstimatedValue + ","; houseEstimatedValue.FontSize = 10; backNavigationButton.IsVisible = Device.OnPlatform(true, false, false); backNavigationButton.Clicked += (sender, args) => { Navigation.PushModalAsync(new HouseListPage()); }; }
public HouseListPage() { NavigationPage.SetHasNavigationBar(this, false); var taskReadJSON = Task.Run( async() => { var result = await JSONDownloader.DownloadSerializedJSONDataAsync <List <House> > (basicInfoUrl); houses = result; }); taskReadJSON.Wait(); houses = imageLinkChanger(); var label = new Label(); label.Text = "Listings"; label.Font = Font.SystemFontOfSize(35); label.HorizontalOptions = LayoutOptions.Center; header = label; this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); cell.SetBinding(TextCell.TextProperty, "Address"); cell.SetBinding(TextCell.DetailProperty, "Features"); cell.SetBinding(ImageCell.ImageSourceProperty, "Image"); listView = new ListView { ItemsSource = houses, ItemTemplate = cell // Set the ImageCell to the item template for the listview }; this.Content = new StackLayout { Children = { header, listView } }; listView.ItemTapped += (sender, args) => { var selectedHouse = args.Item; Navigation.PushModalAsync(new SelectedItemPage((House)selectedHouse)); }; }