Пример #1
0
            bool IWeakEventListener.ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
            {
                if (typeof(CollectionChangedEventManager) == managerType)
                {
                    Debug.Assert(sender == m_groupLevelDescriptions);

                    switch ((( NotifyCollectionChangedEventArgs )e).Action)
                    {
                    case NotifyCollectionChangedAction.Move:
                    case NotifyCollectionChangedAction.Remove:
                        break;

                    default:
                        if (GroupLevelDescriptionFinder.TryFind(m_groupLevelDescriptions, m_groupDescription, out m_groupLevelDescription))
                        {
                            this.RaisePropertyChanged("GroupLevelDescription");
                            this.Dispose();
                        }
                        break;
                    }

                    return(true);
                }

                return(false);
            }
Пример #2
0
            internal GroupLevelDescriptionFinder(GroupDescription groupDescription, IEnumerable <GroupLevelDescription> groupLevelDescriptions)
            {
                if (groupDescription == null)
                {
                    throw new ArgumentNullException("groupDescription");
                }

                if (groupLevelDescriptions == null)
                {
                    throw new ArgumentNullException("groupLevelDescriptions");
                }

                if (!GroupLevelDescriptionFinder.TryFind(groupLevelDescriptions, groupDescription, out m_groupLevelDescription))
                {
                    m_groupDescription       = groupDescription;
                    m_groupLevelDescriptions = groupLevelDescriptions;

                    this.RegisterCollectionChanged(( INotifyCollectionChanged )groupLevelDescriptions);
                }
            }