void PlaybackList_CurrentItemChanged(MediaPlaybackList sender, CurrentMediaPlaybackItemChangedEventArgs args)
{
// Get the new item
var item = args.NewItem;
Debug.WriteLine("PlaybackList_CurrentItemChanged: " + (item == null ? "null" : GetTrackId(item).ToString()));
// Update the system view
UpdateUVCOnNewTrack(item);
// Get the current track
string currentTrackId = null;
if (item != null)
currentTrackId = item.Source.CustomProperties[TrackIdKey] as string;
// Notify foreground of change or persist for later
if (foregroundAppState == AppState.Active)
MessageService.SendMessageToForeground(new TrackChangedMessage(currentTrackId));
else
ApplicationSettingsHelper.SaveSettingsValue(TrackIdKey, currentTrackId?.ToString());
}