/// <summary> /// Updates the community rating. /// </summary> /// <param name="item">The item.</param> private void UpdateCommunityRating(BaseItemDto item) { if (!item.CommunityRating.HasValue) { return; } var images = new[] { ImgCommunityRating1, ImgCommunityRating2, ImgCommunityRating3, ImgCommunityRating4, ImgCommunityRating5 }; var rating = item.CommunityRating.Value; for (var i = 0; i < 5; i++) { var img = images[i]; var starValue = (i + 1) * 2; if (rating < starValue - 2) { img.SetResourceReference(StyleProperty, "CommunityRatingImageEmpty"); } else if (rating < starValue) { img.SetResourceReference(StyleProperty, "CommunityRatingImageHalf"); } else { img.SetResourceReference(StyleProperty, "CommunityRatingImageFull"); } } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); var mediaTypes = new[] { MediaType.Video, MediaType.Audio, MediaType.Game, MediaType.Book }; SelectMediaType.Options = mediaTypes.Select(i => new SelectListItem { Text = i, Value = i }).ToList(); SelectMediaType.SelectedValue = SelectMediaType.Options[0].Value; SelectIsoSupport.Options = new List<SelectListItem> { new SelectListItem{ Text = "None", Value = IsoConfiguration.None.ToString()}, new SelectListItem{ Text = "Mount", Value = IsoConfiguration.Mount.ToString()}, new SelectListItem{ Text = "Pass directly to player", Value = IsoConfiguration.PassThrough.ToString()} }; Loaded += ConfigureMediaPlayerPage_Loaded; SelectPlayer.SelectedItemChanged += SelectPlayer_SelectedItemChanged; SelectMediaType.SelectedItemChanged += SelectMediaType_SelectedItemChanged; SelectGameSystem.SelectedItemChanged += SelectGameSystem_SelectedItemChanged; BtnSubmit.Click += BtnSubmit_Click; }