private void VideoPlayer_PartSwitched(object sender, int e) { PartListView.SelectedIndex = PartGridView.SelectedIndex = e; PartListView.ScrollIntoView(BangumiPartCollection[e], ScrollIntoViewAlignment.Leading); }
private async Task <bool> InitDetail() { TitleBlock.Text = _detail.title; PlayCountBlock.Text = _detail.stat.play; DanmukuCountBlock.Text = AppTool.GetNumberAbbreviation(_detail.stat.danmakus); RepostButton.Text = AppTool.GetNumberAbbreviation(_detail.stat.share); CommentButton.Text = AppTool.GetNumberAbbreviation(_detail.stat.reply); DescriptionBlock.Text = _detail.evaluate; ToolTipService.SetToolTip(DescriptionBlock, _detail.evaluate); if (_detail.rating != null) { ScoreBlock.Text = _detail.rating.score.ToString(); ScoreCountBlock.Text = AppTool.GetNumberAbbreviation(_detail.rating.count) + "人"; } else { RatingContainer.Visibility = Visibility.Collapsed; } BasicInfoBlock.Text = $"{_detail.type_desc}\n{_detail.publish.release_date_show}\n{_detail.publish.time_length_show}"; CoinButton.Text = AppTool.GetNumberAbbreviation(_detail.stat.coins); CoverImage.Source = new BitmapImage(new Uri(_detail.cover + "@200w.jpg")); Section1Title.Text = _detail.actor.title; Section1Content.Text = _detail.actor.info; if (string.IsNullOrEmpty(_detail.actor.info)) { Section1Container.Visibility = Visibility.Collapsed; } Section2Title.Text = _detail.staff.title; Section2Content.Text = _detail.staff.info; if (string.IsNullOrEmpty(_detail.staff.info)) { Section2Container.Visibility = Visibility.Collapsed; } _detail.episodes.ForEach(p => BangumiPartCollection.Add(p)); if (isEp) { for (int i = 0; i < _detail.episodes.Count; i++) { var part = _detail.episodes[i]; if (part.id == bangumiId) { _currentPart = part; PartListView.SelectedIndex = PartGridView.SelectedIndex = i; PartListView.ScrollIntoView(part, ScrollIntoViewAlignment.Leading); PartGridView.ScrollIntoView(part, ScrollIntoViewAlignment.Leading); break; } } bangumiId = _detail.season_id; } else if (_detail.user_status.progress != null) { _currentPart = _detail.episodes.Where(p => p.id == _detail.user_status.progress.last_ep_id).FirstOrDefault(); if (_currentPart != null) { int lastIndex = _detail.episodes.IndexOf(_currentPart); PartListView.SelectedIndex = PartGridView.SelectedIndex = lastIndex - 1 < -1 ? -1 : lastIndex; PartListView.ScrollIntoView(_currentPart, ScrollIntoViewAlignment.Leading); PartGridView.ScrollIntoView(_currentPart, ScrollIntoViewAlignment.Leading); } } if (_currentPart == null && _detail.episodes.Count > 0) { _currentPart = _detail.episodes.First(); PartListView.SelectedIndex = PartGridView.SelectedIndex = 0; } if (_detail.styles != null && _detail.styles.Count > 0) { TagListView.Visibility = Visibility.Visible; _detail.styles.ForEach(p => TagCollection.Add(p)); } else { TagListView.Visibility = Visibility.Collapsed; } CheckFollowButton(); if (_detail.limit != null) { await new ConfirmDialog(_detail.limit.content).ShowAsync(); return(false); } return(true); }