示例#1
0
        private void OnSongsCollectionChanged(object sender, SongCollectionChangedEventArgs e)
        {
            MobileDebug.Service.WriteEvent("PlaylistSubscribtionHandler.OnSongsCollectionChanged", (sender as ISongCollection)?.Parent?.Name);
            Unsubscribe(e.GetRemoved());
            Subscribe(e.GetAdded());

            SongCollectionChanged?.Invoke(this, new SubscriptionsEventArgs <ISongCollection, SongCollectionChangedEventArgs>(sender, e));
        }
示例#2
0
        private void Parent_CollectionChanged(object sender, SongCollectionChangedEventArgs e)
        {
            List <ChangeCollectionItem <Song> > adds = new List <ChangeCollectionItem <Song> >();

            foreach (Song addSong in e.GetAdded())
            {
                int index = ran.Next(Count - e.RemovedSongs.Length + adds.Count);

                adds.Add(new ChangeCollectionItem <Song>(index, addSong));
            }

            Change(e.GetRemoved(), adds);
        }
示例#3
0
        private void Parent_CollectionChanged(object sender, SongCollectionChangedEventArgs e)
        {
            Song[] ordered = GetOrdered(Parent).ToArray();

            Change(e.GetRemoved(), e.GetAdded().Select(s => new ChangeCollectionItem <Song>(Array.IndexOf(ordered, s), s)));
        }