示例#1
0
        public void EmptyPosition(int songOrder)
        {
            var plSong = PLAYLIST_SONGS.FirstOrDefault(i => i.ORDER == songOrder);

            if (plSong != null)
            {
                ShiftSongDown(plSong);
            }
        }
示例#2
0
        private void ShiftSongDown(PLAYLIST_SONG plSong)
        {
            var songInTargetPosition = PLAYLIST_SONGS.FirstOrDefault(i => i.ORDER == plSong.ORDER + 1);

            if (songInTargetPosition != null)
            {
                MoveSongDown(songInTargetPosition);
            }
            plSong.ORDER = plSong.ORDER + 1;
        }
示例#3
0
        public void MoveSongUp(PLAYLIST_SONG plSong)
        {
            if (!PLAYLIST_SONGS.Any(i => i.ORDER < plSong.ORDER))
            {
                return;
            }
            var targetPlSong =
                PLAYLIST_SONGS.Where(i => i.ORDER < plSong.ORDER).OrderByDescending(k => k.ORDER).FirstOrDefault();
            int newPosition = targetPlSong.ORDER;

            targetPlSong.ORDER = plSong.ORDER;
            plSong.ORDER       = newPosition;
        }
示例#4
0
        public void MoveSongDown(PLAYLIST_SONG plSong)
        {
            if (!PLAYLIST_SONGS.Any(i => i.ORDER > plSong.ORDER))
            {
                return;
            }

            var songInTargetPosition = PLAYLIST_SONGS.Where(i => i.ORDER > plSong.ORDER).OrderBy(k => k.ORDER).FirstOrDefault();
            var newPosition          = songInTargetPosition.ORDER;

            songInTargetPosition.ORDER = plSong.ORDER;
            plSong.ORDER = newPosition;
        }