Beispiel #1
0
        public void BuildMusicTable()
        {
            if (!musicPlaylist.IsMusicAvailable)
            {
                return;
            }

            var music = musicPlaylist.AvailablePlaylist();

            currentSong = musicPlaylist.CurrentSong();

            musicList.RemoveChildren();
            foreach (var song in music)
            {
                var item  = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong == song, () => { currentSong = song; Play(); }, () => { });
                var label = item.Get <LabelWithTooltipWidget>("TITLE");
                WidgetUtils.TruncateLabelToTooltip(label, song.Title);

                item.Get <LabelWidget>("LENGTH").GetText = () => SongLengthLabel(song);
                musicList.AddChild(item);
            }

            if (currentSong != null && !musicPlaylist.CurrentSongIsBackground)
            {
                musicList.ScrollToItem(currentSong.Filename);
            }
        }
Beispiel #2
0
        public void BuildMusicTable()
        {
            if (!musicPlaylist.IsMusicAvailable)
            {
                return;
            }

            var music = musicPlaylist.AvailablePlaylist();

            currentSong = musicPlaylist.CurrentSong();
            if (currentSong == null && music.Any())
            {
                currentSong = musicPlaylist.GetNextSong();
            }

            musicList.RemoveChildren();
            foreach (var s in music)
            {
                var song = s;
                if (currentSong == null)
                {
                    currentSong = song;
                }

                var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong == song, () => { currentSong = song; Play(); }, () => { });
                item.Get <LabelWidget>("TITLE").GetText  = () => song.Title;
                item.Get <LabelWidget>("LENGTH").GetText = () => SongLengthLabel(song);
                musicList.AddChild(item);
            }

            if (currentSong != null)
            {
                musicList.ScrollToItem(currentSong.Filename);
            }
        }