Exemplo n.º 1
0
        private void RefreshLyricTime()
        {
            if (HyPlayList.lyricpos < 0 || HyPlayList.lyricpos >= LyricList.Count)
            {
                return;
            }
            if (HyPlayList.lyricpos == -1)
            {
                lastitem?.OnHind();
                LyricBoxContainer.ChangeView(null, 0, null, false);
            }
            LyricItem item = LyricList[HyPlayList.lyricpos];

            if (item == null)
            {
                return;
            }
            lastitem?.OnHind();
            item?.OnShow();
            lastitem = item;
            if (sclock > 0)
            {
                sclock--;
                return;
            }
            GeneralTransform transform = item?.TransformToVisual((UIElement)LyricBoxContainer.Content);
            Point?           position  = transform?.TransformPoint(new Point(0, 0));

            LyricBoxContainer.ChangeView(null, position?.Y - (LyricBoxContainer.ViewportHeight / 3), null, false);
        }
Exemplo n.º 2
0
        private void RefreshLyricTime(TimeSpan nowtime)
        {
            LyricItem lastlrcitem = null;
            bool      showed      = false;

            foreach (UIElement lyricBoxChild in LyricBox.Children)
            {
                if (lyricBoxChild is LyricItem lrcitem)
                {
                    if (HyPlayList.Player.PlaybackSession.Position < lrcitem.Lrc.LyricTime)
                    {
                        if (!showed)
                        {
                            lastlrcitem?.OnShow();
                            lrcitem.OnHind();
                            if (sclock > 0)
                            {
                                sclock--;
                                return;
                            }

                            var transform = lastlrcitem?.TransformToVisual((UIElement)LyricBoxContainer.Content);
                            var position  = transform?.TransformPoint(new Point(0, 0));
                            LyricBoxContainer.ChangeView(null, position?.Y - (LyricBoxContainer.ViewportHeight / 3), null, false);;
                            showed = true;
                        }
                        else
                        {
                            lrcitem.OnHind();
                        }
                    }
                    else
                    {
                        lrcitem.OnHind();
                    }
                    lastlrcitem = lrcitem;
                }
            }

            if (!showed && lastlrcitem != null)
            {
                lastlrcitem.OnShow();
                if (sclock > 0)
                {
                    sclock--;
                    return;
                }
                var transform = lastlrcitem.TransformToVisual((UIElement)LyricBoxContainer.Content);
                var position  = transform.TransformPoint(new Point(0, 0));
                LyricBoxContainer.ChangeView(null, position.Y - (LyricBoxContainer.ViewportHeight / 3), null, false);
                showed = true;
            }

            //暂停按钮
            PlayStateIcon.Glyph = HyPlayList.isPlaying ? "\uEDB4" : "\uEDB5";
            //播放进度
            ProgressBarPlayProg.Value = HyPlayList.Player.PlaybackSession.Position.TotalMilliseconds;
        }
Exemplo n.º 3
0
        private void RefreshLyricTime(SongLyric LRC)
        {
            LyricItem item = LyricList.Find(t => t.Lrc.LyricTime == LRC.LyricTime);

            item.OnShow();
            if (sclock > 0)
            {
                sclock--;
                return;
            }

            GeneralTransform transform = item?.TransformToVisual((UIElement)LyricBoxContainer.Content);
            Point?           position  = transform?.TransformPoint(new Point(0, 0));

            LyricBoxContainer.ChangeView(null, position?.Y - (LyricBoxContainer.ViewportHeight / 3), null, false);;
            LyricList.FindAll(t => t.Lrc.LyricTime != LRC.LyricTime).ForEach(t => t.OnHind());
        }