Ejemplo n.º 1
0
        public void SetInfoByRef(Song song, bool autoplay = false)
        {
            SongOwned = song;
            if (PlayArea.Height < DefaultHeight && First)
            {
                expandplayarea();
                First = false;
            }
            AlbumCoverImage.Source     = new BitmapImage(new Uri(song.album_url, UriKind.Absolute));
            BackImage.Source           = AlbumCoverImage.Source;
            SongPLayingName.Text       = song.name;
            SongPLayingSingerName.Text = song.singers;

            PlayProcess.Maximum = song.timeint;
            PlayProcess.Value   = 0;

            _mediaTimelineController.Pause();

            WholeTime.Text = "/" + song.interval;
            NowTime.Text   = "0:00";

            PlayAndPause.Icon = new SymbolIcon(Symbol.Play);
            MusicRes          = "shit";                            //symbol
            string Songmid = song.songmid;

            LyricArea.GetLyrics(Songmid);

            var t = new Thread(() => MusicRes = Creeper.GetSongResourseURL(Songmid));

            t.Start();

            // switch song
            if (App.Musicplayer.Source != null)
            {
                App.Musicplayer.Source = null;
                if (App.Musicplayer.PlaybackSession.PlaybackState == MediaPlaybackState.Playing)   //is playing
                {
                    App.Musicplayer.TimelineControllerPositionOffset = TimeSpan.FromSeconds(0);
                }
                PrepareSourse();
            }
            else if (autoplay)
            {
                PrepareSourse();
            }
        }
Ejemplo n.º 2
0
 private async void _mediaTimelineController_PositionChanged(MediaTimelineController sender, object args)
 {
     if (_duration != TimeSpan.Zero && !ISMoving)
     {
         await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             int nowtime = Convert.ToInt32(sender.Position.TotalSeconds);
             if (nowtime % 60 > 9)
             {
                 NowTime.Text = (nowtime / 60).ToString() + ":" + (nowtime % 60).ToString();
             }
             else
             {
                 NowTime.Text = (nowtime / 60).ToString() + ":0" + (nowtime % 60).ToString();
             }
             PlayProcess.Value = nowtime;
             LyricArea.Settime(Convert.ToDouble(nowtime));
             if (nowtime == PlayProcess.Maximum)   //play complete
             {
                 MusicListSet(Playingid + 1);
             }
         });
     }
 }