Esempio n. 1
0
        void UpdateNowPlayingScreen(MenuScreen nowPlayingScreen, TrackInfo nowPlaying)
        {
            nowPlayingScreen.IsUpdateSuspended = true;

            nowPlayingScreen.Status = nowPlaying.GetTrackPlaylistPosition();

            nowPlayingScreen.ClearItems();
            if (NowPlayingTagsSeparatedRows)
            {
                if (!StringHelpers.IsNullOrEmpty(nowPlaying.Title))
                {
                    nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.Title));
                }
                if (!StringHelpers.IsNullOrEmpty(nowPlaying.Artist))
                {
                    nowPlayingScreen.AddItem(new MenuItem(i => CharIcons.BordmonitorBull + " " + Localization.Current.Artist + ":"));
                    nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.Artist));
                }
                if (!StringHelpers.IsNullOrEmpty(nowPlaying.Album))
                {
                    nowPlayingScreen.AddItem(new MenuItem(i => CharIcons.BordmonitorBull + " " + Localization.Current.Album + ":"));
                    nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.Album));
                }
                if (!StringHelpers.IsNullOrEmpty(nowPlaying.Genre))
                {
                    nowPlayingScreen.AddItem(new MenuItem(i => CharIcons.BordmonitorBull + " " + Localization.Current.Genre + ":"));
                    nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.Genre));
                }
            }
            else
            {
                if (!StringHelpers.IsNullOrEmpty(nowPlaying.Title))
                {
                    nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.GetTitleWithLabel()));
                }
                if (!StringHelpers.IsNullOrEmpty(nowPlaying.Artist))
                {
                    nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.GetArtistWithLabel()));
                }
                if (!StringHelpers.IsNullOrEmpty(nowPlaying.Album))
                {
                    nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.GetAlbumWithLabel()));
                }
                if (!StringHelpers.IsNullOrEmpty(nowPlaying.Genre))
                {
                    nowPlayingScreen.AddItem(new MenuItem(i => nowPlaying.GetGenreWithLabel()));
                }
            }
            nowPlayingScreen.AddBackButton();

            nowPlayingScreen.IsUpdateSuspended = false;
            nowPlayingScreen.Refresh();
        }
Esempio n. 2
0
 protected virtual void OnNowPlayingChanged(TrackInfo nowPlaying)
 {
     var e = NowPlayingChanged;
     if (e != null)
     {
         e.Invoke(this, nowPlaying);
     }
 }
Esempio n. 3
0
 void ParseNowPlaying(string[] p)
 {
     var i = 0;
     string tag = null;
     string value = null;
     var n = new TrackInfo();
     foreach (var s in p)
     {
         var isLast = i == p.Length - 1;
         var isTag = nowPlayingTags.Contains(s) && (value == null || value.Length > 0 && value[value.Length - 1] == '"');
         if (tag != null && !isTag)
         {
             value = (value == null) ? s : value + " " + s;
         }
         if (isLast || isTag)
         {
             if (tag != null && value.Length > 2)
             {
                 value = value.Substring(1, value.Length - 2);
                 switch (tag)
                 {
                     case "TITLE":
                         n.Title = value;
                         break;
                     case "ARTIST":
                         n.Artist = value;
                         break;
                     case "ALBUM":
                         n.Album = value;
                         break;
                     case "GENRE":
                         n.Genre = value;
                         break;
                     case "TRACK_NUMBER":
                         try { n.TrackNumber = int.Parse(value); }
                         catch { }
                         break;
                     case "TOTAL_TRACK_NUMBER":
                         try { n.TotalTracks = int.Parse(value); }
                         catch { }
                         break;
                     case "PLAYING_TIME":
                         try { n.TrackLength = int.Parse(value); }
                         catch { }
                         break;
                 }
             }
             if (isTag)
             {
                 tag = s;
                 value = null;
             }
         }
         i++;
     }
     NowPlaying = n;
 }
Esempio n. 4
0
 public static string GetTrackPlaylistPosition(this TrackInfo n)
 {
     return(n.TrackNumber + " / " + n.TotalTracks);
 }