private async Task InitMusicBoardAsync(MusicBoardParameter args)
        {
            try {
                is_init_progress = true;
                sid           = args.SID;
                ssid          = args.SSID;
                aid           = args.AID;
                path_url      = args.Url;
                identity_song = MHzSongBaseHelper.GetIdentity(args);
                THIS_SONG     = args.Song;

                await GetMusicDetailsAsync();

                UnregisterServiceEvents();
                RegisterServiceEvents();

                MusicSlider.ValueChanged -= MusicSlider_ValueChanged;
                MusicBoardVM.CurrentTime  = Service.Session.Position;
                MusicBoardVM.Duration     = Service.Session.NaturalDuration;
                MusicSlider.ValueChanged += MusicSlider_ValueChanged;

                MusicBoardVM.BackImage   = image;
                MusicBoardVM.LrcTitle    = title;
                MusicBoardVM.ListCount   = Service.CurrentSongList.Count;
                MusicBoardVM.CurrentItem = Service.CurrentItem;

                RandomButton.Content =
                    Service.PlayType == MusicServicePlayType.ShufflePlay ? char.ConvertFromUtf32(0xE8B1) :
                    Service.PlayType == MusicServicePlayType.AutoRepeat ? char.ConvertFromUtf32(0xE8EE) :
                    Service.PlayType == MusicServicePlayType.SingletonPlay ? char.ConvertFromUtf32(0xE8ED) :
                    char.ConvertFromUtf32(0xE84F);

                SongListButton.Content = Service.ServiceType == MusicServiceType.SongList ?
                                         char.ConvertFromUtf32(0xE142) :
                                         char.ConvertFromUtf32(0xE93E);

                if (Service.Session.PlaybackState == MediaPlaybackState.Playing)
                {
                    DoWorkWhenMusicPlayed();
                }
                else if (Service.Session.PlaybackState == MediaPlaybackState.Paused)
                {
                    DoWorkWhenMusicPaused();
                }

                MusicBoardVM.LrcList           = null;
                ChangeDownloadStatus(is_cached = await StorageHelper.IsExistLocalJsonBySHA256Async(MHzSongBaseHelper.GetIdentity(args)));
                songMessCollection             = (await LrcProcessHelper.GetSongMessageListAsync(title, artist)) ?? new List <LrcMetaData>();
            } catch {
                ReportHelper.ReportAttentionAsync(GetUIString("MediaSource_EEEEEEEError"));
            } finally { await SetDefaultLrcAndAnimationsAsync(); }
        }
Esempio n. 2
0
 public static async Task <MediaPlaybackItem> CreatePlayItemAsync(string url, string img, MusicBoardParameter para)
 {
     return(await CreatePlayItemAsync(new Uri(url), new Uri(img), para));
 }
Esempio n. 3
0
 public static async Task <MediaPlaybackItem> CreatePlayItemAsync(Uri uri, Uri img, MusicBoardParameter para)
 {
     return(await CreatePlayItemAsync(uri, img, para, GetUIString("UnknownMusicTitle"), GetUIString("UnknownMusicArtist")));
 }
Esempio n. 4
0
 public static async Task <MediaPlaybackItem> CreatePlayItemAsync(Uri uri, Uri img, MusicBoardParameter para, string title, string artist)
 {
     return(await CreatePlayItemAsync(uri, img, para, title, artist, "", ""));
 }
Esempio n. 5
0
 public static async Task <MediaPlaybackItem> CreatePlayItemAsync(string url, Uri img, MusicBoardParameter para, string title, string artist, string albumTitle, string albunmArtist)
 {
     return(await CreatePlayItemAsync(new Uri(url), img, para, title, artist, albumTitle, albunmArtist));
 }
Esempio n. 6
0
        public async static Task <MediaPlaybackItem> CreatePlayItemAsync(Uri uri, Uri img, MusicBoardParameter para, string title, string artist, string albumTitle, string albunmArtist)
        {
            var storage = await StorageHelper.FetchLocalMusicBySHA256Async(MHzSongBaseHelper.GetIdentity(para));

            var source = default(MediaSource);

            source = storage != null?MediaSource.CreateFromStorageFile(storage) : MediaSource.CreateFromUri(uri);

            source.CustomProperties["Title"]      = title;
            source.CustomProperties["CheckPoint"] = SetCheckPoint(UTCPoint);
            source.CustomProperties["SHA256"]     = para.SHA256;
            source.CustomProperties["Message"]    = para;
            var item       = new MediaPlaybackItem(source);
            var properties = item.GetDisplayProperties();

            properties.Type                        = Windows.Media.MediaPlaybackType.Music;
            properties.Thumbnail                   = RandomAccessStreamReference.CreateFromUri(img);
            properties.MusicProperties.Title       = title;
            properties.MusicProperties.Artist      = artist;
            properties.MusicProperties.AlbumTitle  = albumTitle;
            properties.MusicProperties.AlbumArtist = albunmArtist;
            item.ApplyDisplayProperties(properties);
            return(item);
        }