protected override void OnAttach()
        {
            var notifiable = inner as INotifyCollectionChanged;

            if (notifiable != null)
            {
                listener.Subscribe(notifiable);
            }
        }
Exemple #2
0
        void SequencesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.Action != NotifyCollectionChangedAction.Reset)
            {
                var notification = CollectionChangedNotificationResult <T> .Create(this);

                var removed = notification.RemovedItems;
                var added   = notification.AddedItems;

                if (e.OldItems != null)
                {
                    foreach (IEnumerable <T> sequence in e.OldItems)
                    {
                        removed.AddRange(sequence);
                        INotifyCollectionChanged notifier = sequence as INotifyCollectionChanged;
                        if (notifier != null)
                        {
                            var listener = changeListener[sequence];
                            listener.Unsubscribe();
                            changeListener.Remove(sequence);
                        }
                    }
                }
                if (e.NewItems != null)
                {
                    foreach (IEnumerable <T> sequence in e.NewItems)
                    {
                        added.AddRange(sequence);
                        INotifyCollectionChanged notifier = sequence as INotifyCollectionChanged;
                        if (notifier != null)
                        {
                            var listener = new CollectionChangeListener <T>(this);
                            listener.Subscribe(notifier);
                            changeListener.Add(sequence, listener);
                        }
                    }
                }

                ExecutionMetaData.Results.Add(notification);
            }
            ExecutionEngine.Current.InvalidateNode(this);
        }