/// <summary> /// <para> Cancels all outstanding operations.</para> /// </summary> public void Cancel() { // Cancel all the sinks we have - make a copy to avoid things // changing under our feet Hashtable copiedSinkTable = new Hashtable(); lock (m_sinkCollection) { // IDictionaryEnumerator sinkEnum = m_sinkCollection.GetEnumerator(); try { sinkEnum.Reset(); while (sinkEnum.MoveNext()) { DictionaryEntry entry = (DictionaryEntry)sinkEnum.Current; copiedSinkTable.Add(entry.Key, entry.Value); } } catch { } } // Now step through the copy and cancel everything try { IDictionaryEnumerator copiedSinkEnum = copiedSinkTable.GetEnumerator(); copiedSinkEnum.Reset(); while (copiedSinkEnum.MoveNext()) { DictionaryEntry entry = (DictionaryEntry)copiedSinkEnum.Current; WmiEventSink eventSink = (WmiEventSink)entry.Value; try { eventSink.Cancel(); } catch { } } } catch { } }
public void Cancel() { Hashtable hashtable = new Hashtable(); lock (this.m_sinkCollection) { IDictionaryEnumerator enumerator = this.m_sinkCollection.GetEnumerator(); try { enumerator.Reset(); while (enumerator.MoveNext()) { DictionaryEntry current = (DictionaryEntry)enumerator.Current; hashtable.Add(current.Key, current.Value); } } catch { } } try { IDictionaryEnumerator enumerator2 = hashtable.GetEnumerator(); enumerator2.Reset(); while (enumerator2.MoveNext()) { DictionaryEntry entry2 = (DictionaryEntry)enumerator2.Current; WmiEventSink sink = (WmiEventSink)entry2.Value; try { sink.Cancel(); continue; } catch { continue; } } } catch { } }
public void Cancel() { Hashtable hashtables = new Hashtable(); lock (this.m_sinkCollection) { IDictionaryEnumerator enumerator = this.m_sinkCollection.GetEnumerator(); try { enumerator.Reset(); while (enumerator.MoveNext()) { DictionaryEntry current = (DictionaryEntry)enumerator.Current; hashtables.Add(current.Key, current.Value); } } catch { } } try { IDictionaryEnumerator dictionaryEnumerator = hashtables.GetEnumerator(); dictionaryEnumerator.Reset(); while (dictionaryEnumerator.MoveNext()) { DictionaryEntry dictionaryEntry = (DictionaryEntry)dictionaryEnumerator.Current; WmiEventSink value = (WmiEventSink)dictionaryEntry.Value; try { value.Cancel(); } catch { } } } catch { } }