/// <summary> /// Loads the content asynchronously. /// </summary> public override async Task LoadContentAsync() { var data = Data.FromJson <Rest.PosterList>(); // // If the menu content hasn't actually changed, then ignore. // if (data.ToJson().ComputeHash() == PosterData.ToJson().ComputeHash()) { return; } PosterData = data; PosterImages = new Bitmap[PosterData.Items.Count]; // // Load the background image and prepate the menu buttons. // BackgroundImage = await Utility.LoadImageFromUrlAsync(Crex.Application.Current.GetAbsoluteUrl(PosterData.BackgroundImage?.BestMatch)); if (BackgroundImage != null) { BackgroundImage = Utility.ScaleImageToWidth(BackgroundImage, ( int )(Crex.Application.Current.Resolution.Width / 2.0f)); BackgroundImage = Utility.CreateBlurredImage(BackgroundImage, 8); } if (Activity != null) { Activity.RunOnUiThread(UpdateUserInterfaceFromContent); } LastLoadedDate = DateTime.Now; }
/// <summary> /// Loads the content asynchronously. /// </summary> public override async Task LoadContentAsync() { var data = Data.FromJson <Rest.PosterList>(); // // If the menu content hasn't actually changed, then ignore. // if (data.ToJson().ComputeHash() == PosterData.ToJson().ComputeHash()) { return; } PosterData = data; // // Load the background image. // try { BackgroundImage = await Utility.LoadImageFromUrlAsync(Crex.Application.Current.GetAbsoluteUrl(PosterData.BackgroundImage.BestMatch)); BackgroundImage = Utility.ScaleImageToWidth(BackgroundImage, ( int )(Crex.Application.Current.Resolution.Width / 2.0f)); BackgroundImage = Utility.CreateBlurredImage(BackgroundImage, 8); } catch { BackgroundImage = null; } ListViewImages = new UIImage[PosterData.Items.Count]; LastLoadedDate = DateTime.Now; InvokeOnMainThread(() => { EnsureView(); TitleView.Text = PosterData.Title; DetailLeftView.Text = string.Empty; DetailRightView.Text = string.Empty; DescriptionView.Text = string.Empty; BackgroundImageView.Image = BackgroundImage; ListView.ReloadData(); SetNeedsFocusUpdate(); }); }