// Token: 0x06008DE7 RID: 36327 RVA: 0x0025A5E8 File Offset: 0x002587E8 public void RemoveHandler(EventHandler <PropertyChangedEventArgs> handler, string propertyName) { StaticPropertyChangedEventManager.PropertyRecord propertyRecord = (StaticPropertyChangedEventManager.PropertyRecord) this._dict[propertyName]; if (propertyRecord != null) { propertyRecord.RemoveHandler(handler); if (propertyRecord.IsEmpty) { this._dict.Remove(propertyName); } this._dict.Remove(StaticPropertyChangedEventManager.AllListenersKey); this._proposedAllListenersList = null; } }
// Token: 0x06008DE6 RID: 36326 RVA: 0x0025A57C File Offset: 0x0025877C public void AddHandler(EventHandler <PropertyChangedEventArgs> handler, string propertyName) { StaticPropertyChangedEventManager.PropertyRecord propertyRecord = (StaticPropertyChangedEventManager.PropertyRecord) this._dict[propertyName]; if (propertyRecord == null) { propertyRecord = new StaticPropertyChangedEventManager.PropertyRecord(propertyName, this); this._dict[propertyName] = propertyRecord; propertyRecord.StartListening(this._type); } propertyRecord.AddHandler(handler); this._dict.Remove(StaticPropertyChangedEventManager.AllListenersKey); this._proposedAllListenersList = null; this._manager.ScheduleCleanup(); }
// Token: 0x06008DEA RID: 36330 RVA: 0x0025A888 File Offset: 0x00258A88 public bool Purge(bool purgeAll) { bool flag = false; if (!purgeAll) { if (!BaseAppContextSwitches.EnableWeakEventMemoryImprovements) { ICollection keys = this._dict.Keys; string[] array = new string[keys.Count]; keys.CopyTo(array, 0); for (int i = array.Length - 1; i >= 0; i--) { if (!(array[i] == StaticPropertyChangedEventManager.AllListenersKey)) { StaticPropertyChangedEventManager.PropertyRecord propertyRecord = (StaticPropertyChangedEventManager.PropertyRecord) this._dict[array[i]]; if (propertyRecord.Purge()) { flag = true; } if (propertyRecord.IsEmpty) { propertyRecord.StopListening(this._type); this._dict.Remove(array[i]); } } } } else { IDictionaryEnumerator enumerator = this._dict.GetEnumerator(); while (enumerator.MoveNext()) { string text = (string)enumerator.Key; if (!(text == StaticPropertyChangedEventManager.AllListenersKey)) { StaticPropertyChangedEventManager.PropertyRecord propertyRecord2 = (StaticPropertyChangedEventManager.PropertyRecord)enumerator.Value; if (propertyRecord2.Purge()) { flag = true; } if (propertyRecord2.IsEmpty) { propertyRecord2.StopListening(this._type); this._toRemove.Add(text); } } } if (this._toRemove.Count > 0) { foreach (string key in this._toRemove) { this._dict.Remove(key); } this._toRemove.Clear(); this._toRemove.TrimExcess(); } } if (flag) { this._dict.Remove(StaticPropertyChangedEventManager.AllListenersKey); this._proposedAllListenersList = null; } if (this.IsEmpty) { this.StopListening(); } } else { flag = true; this.StopListening(); foreach (object obj in this._dict) { StaticPropertyChangedEventManager.PropertyRecord propertyRecord3 = (StaticPropertyChangedEventManager.PropertyRecord)((DictionaryEntry)obj).Value; propertyRecord3.StopListening(this._type); } } return(flag); }
// Token: 0x06008DE8 RID: 36328 RVA: 0x0025A63C File Offset: 0x0025883C public WeakEventManager.ListenerList GetListenerList(string propertyName) { WeakEventManager.ListenerList listenerList3; if (!string.IsNullOrEmpty(propertyName)) { StaticPropertyChangedEventManager.PropertyRecord propertyRecord = (StaticPropertyChangedEventManager.PropertyRecord) this._dict[propertyName]; WeakEventManager.ListenerList <PropertyChangedEventArgs> listenerList = (propertyRecord == null) ? null : propertyRecord.List; StaticPropertyChangedEventManager.PropertyRecord propertyRecord2 = (StaticPropertyChangedEventManager.PropertyRecord) this._dict[string.Empty]; WeakEventManager.ListenerList <PropertyChangedEventArgs> listenerList2 = (propertyRecord2 == null) ? null : propertyRecord2.List; if (listenerList2 == null) { if (listenerList != null) { listenerList3 = listenerList; } else { listenerList3 = WeakEventManager.ListenerList.Empty; } } else if (listenerList != null) { listenerList3 = new WeakEventManager.ListenerList <PropertyChangedEventArgs>(listenerList.Count + listenerList2.Count); int i = 0; int count = listenerList.Count; while (i < count) { listenerList3.Add(listenerList[i]); i++; } int j = 0; int count2 = listenerList2.Count; while (j < count2) { listenerList3.Add(listenerList2[j]); j++; } } else { listenerList3 = listenerList2; } } else { StaticPropertyChangedEventManager.PropertyRecord propertyRecord3 = (StaticPropertyChangedEventManager.PropertyRecord) this._dict[StaticPropertyChangedEventManager.AllListenersKey]; WeakEventManager.ListenerList <PropertyChangedEventArgs> listenerList4 = (propertyRecord3 == null) ? null : propertyRecord3.List; if (listenerList4 == null) { int num = 0; foreach (object obj in this._dict) { num += ((StaticPropertyChangedEventManager.PropertyRecord)((DictionaryEntry)obj).Value).List.Count; } listenerList4 = new WeakEventManager.ListenerList <PropertyChangedEventArgs>(num); foreach (object obj2 in this._dict) { WeakEventManager.ListenerList list = ((StaticPropertyChangedEventManager.PropertyRecord)((DictionaryEntry)obj2).Value).List; int k = 0; int count3 = list.Count; while (k < count3) { listenerList4.Add(list.GetListener(k)); k++; } } this._proposedAllListenersList = listenerList4; } listenerList3 = listenerList4; } return(listenerList3); }