Exemple #1
0
        public async Task UpdateNowPlaying()
        {
            uint position = Playlist.CurrentItemIndex;

            if (position == 4294967295) //Magic number?? Perfectly totient.
            {
                SongListStorage.CurrentPlaceInPlaylist = 0;
            }
            else
            {
                SongListStorage.CurrentPlaceInPlaylist = (int)position;
            }
            if (SongListStorage.PlaylistRepresentation.Count > 0)
            {
                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                            async() =>
                {
                    Currentart = await SongListStorage.GetCurrentSongArt(100);
                }
                                                                                                            );

                Currenttitle  = SongListStorage.GetCurrentSongName();
                Currentartist = SongListStorage.GetCurrentArtistName();

                //set the system transport controls
                //mediaPlayer.SystemMediaTransportControls.IsEnabled = true;
                var props = mediaPlayer.SystemMediaTransportControls.DisplayUpdater;
                props.Type = Windows.Media.MediaPlaybackType.Music;
                //props.AppMediaId = "TOAST";
                //props.MusicProperties.Title = "TEST";
                //props.Update();
                //var musicprops = props.MusicProperties;
                var file = await SongListStorage.GetCurrentSongFile();

                bool ok = await props.CopyFromFileAsync(Windows.Media.MediaPlaybackType.Music, file);

                //props.AppMediaId = "dwioahjdioaw";
                //props.Type = Windows.Media.MediaPlaybackType.Music;
                props.Update();
            }
            SongListStorage.SavePlace();
        }