コード例 #1
0
        private void OnCurrentSongChanged(object sender, CurrentSongChangedEventArgs e)
        {
            CurrentSong.Unsubscribe(e.OldCurrentSong);
            CurrentSong.Subscribe(e.NewCurrentSong);

            OtherSongs.Unsubscribe(e.NewCurrentSong);
            OtherSongs.Subscribe(e.OldCurrentSong);

            CurrentSongChanged?.Invoke(this, new SubscriptionsEventArgs <IPlaylist, CurrentSongChangedEventArgs>(sender, e));
        }
コード例 #2
0
        private void Subscribe(IEnumerable <Song> songs)
        {
            foreach (Song song in songs ?? Enumerable.Empty <Song>())
            {
                bool isCurrentSong = song == song.Parent.Parent.CurrentSong;

                if (isCurrentSong)
                {
                    CurrentSong.Subscribe(song);
                }
                else
                {
                    OtherSongs.Subscribe(song);
                }

                AllSongs.Subscribe(song);
            }
        }