private HRESULT _UpdateThumbButtons(bool attached) { THUMBBUTTON[] array = new THUMBBUTTON[7]; HRESULT result = this._RegisterThumbButtons(); if (result.Failed) { return(result); } ThumbButtonInfoCollection thumbButtonInfos = this.ThumbButtonInfos; HRESULT result2; try { uint num = 0u; if (!attached || thumbButtonInfos == null) { goto IL_1AE; } using (FreezableCollection <ThumbButtonInfo> .Enumerator enumerator = thumbButtonInfos.GetEnumerator()) { while (enumerator.MoveNext()) { ThumbButtonInfo thumbButtonInfo = enumerator.Current; THUMBBUTTON thumbbutton = new THUMBBUTTON { iId = num, dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) }; switch (thumbButtonInfo.Visibility) { case Visibility.Visible: goto IL_A5; case Visibility.Hidden: thumbbutton.dwFlags = (THBF.DISABLED | THBF.NOBACKGROUND); thumbbutton.hIcon = IntPtr.Zero; break; case Visibility.Collapsed: thumbbutton.dwFlags = THBF.HIDDEN; break; default: goto IL_A5; } IL_146: array[(int)((UIntPtr)num)] = thumbbutton; num += 1u; if (num != 7u) { continue; } break; IL_A5: thumbbutton.szTip = (thumbButtonInfo.Description ?? ""); thumbbutton.hIcon = this._GetHICONFromImageSource(thumbButtonInfo.ImageSource, this._overlaySize); if (!thumbButtonInfo.IsBackgroundVisible) { thumbbutton.dwFlags |= THBF.NOBACKGROUND; } if (!thumbButtonInfo.IsEnabled) { thumbbutton.dwFlags |= THBF.DISABLED; } else { thumbbutton.dwFlags = thumbbutton.dwFlags; } if (!thumbButtonInfo.IsInteractive) { thumbbutton.dwFlags |= THBF.NONINTERACTIVE; } if (thumbButtonInfo.DismissWhenClicked) { thumbbutton.dwFlags |= THBF.DISMISSONCLICK; goto IL_146; } goto IL_146; } goto IL_1AE; } IL_179: array[(int)((UIntPtr)num)] = new THUMBBUTTON { iId = num, dwFlags = (THBF.DISABLED | THBF.NOBACKGROUND | THBF.HIDDEN), dwMask = (THB.ICON | THB.TOOLTIP | THB.FLAGS) }; num += 1u; IL_1AE: if (num < 7u) { goto IL_179; } result2 = this._taskbarList.ThumbBarUpdateButtons(this._hwndSource.Handle, (uint)array.Length, array); } finally { foreach (THUMBBUTTON thumbbutton2 in array) { IntPtr hIcon = thumbbutton2.hIcon; if (IntPtr.Zero != hIcon) { Utility.SafeDestroyIcon(ref hIcon); } } } return(result2); }
private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: { IEnumerator enumerator = e.NewItems.GetEnumerator(); try { while (enumerator.MoveNext()) { T current = (T)enumerator.Current; try { this.VerifyAdd(current); this.ItemAdded(current); } finally { this.snapshot.Insert(base.IndexOf(current), current); } } return; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } break; } case NotifyCollectionChangedAction.Remove: { IEnumerator enumerator1 = e.OldItems.GetEnumerator(); try { while (enumerator1.MoveNext()) { T t = (T)enumerator1.Current; this.ItemRemoved(t); this.snapshot.Remove(t); } return; } finally { IDisposable disposable1 = enumerator1 as IDisposable; if (disposable1 != null) { disposable1.Dispose(); } } break; } case NotifyCollectionChangedAction.Replace: { foreach (T oldItem in e.OldItems) { this.ItemRemoved(oldItem); this.snapshot.Remove(oldItem); } IEnumerator enumerator2 = e.NewItems.GetEnumerator(); try { while (enumerator2.MoveNext()) { T current1 = (T)enumerator2.Current; try { this.VerifyAdd(current1); this.ItemAdded(current1); } finally { this.snapshot.Insert(base.IndexOf(current1), current1); } } return; } finally { IDisposable disposable2 = enumerator2 as IDisposable; if (disposable2 != null) { disposable2.Dispose(); } } break; } case NotifyCollectionChangedAction.Move: { return; } case NotifyCollectionChangedAction.Reset: { foreach (T t1 in this.snapshot) { this.ItemRemoved(t1); } this.snapshot = new Collection <T>(); FreezableCollection <T> .Enumerator enumerator3 = base.GetEnumerator(); try { while (enumerator3.MoveNext()) { T current2 = enumerator3.Current; this.VerifyAdd(current2); this.ItemAdded(current2); } return; } finally { ((IDisposable)enumerator3).Dispose(); } break; } default: { return; } } }