public void CopyTo(System.Collections.Generic.Internal.List <EventRegistrationToken> tokens) { tokens.Add(firstToken); if (restTokens != null) { for (int i = 0; i < restTokens.Count; i++) { tokens.Add(restTokens[i]); } } }
// // Call removeMethod on each token and aggregate all exceptions thrown from removeMethod into one in case of failure // internal static void CallRemoveMethods(Action <EventRegistrationToken> removeMethod, System.Collections.Generic.Internal.List <EventRegistrationToken> tokensToRemove) { System.Collections.Generic.Internal.List <Exception> exceptions = new System.Collections.Generic.Internal.List <Exception>(); for (int i = 0; i < tokensToRemove.Count; i++) { try { removeMethod(tokensToRemove[i]); } catch (Exception ex) { exceptions.Add(ex); } #if false BCLDebug.Log("INTEROP", "[WinRT_Eventing] Event unsubscribed for token = " + token.m_value + "\n"); #endif } if (exceptions.Count > 0) #if false { throw new AggregateException(exceptions.ToArray()); } #else { throw exceptions[0]; } #endif }
// Push a new token into this list // Returns true if you need to copy back this list into the dictionary (so that you // don't lose change outside the dictionary). false otherwise. public bool Push(EventRegistrationToken token) { bool needCopy = false; if (restTokens == null) { restTokens = new System.Collections.Generic.Internal.List <EventRegistrationToken>(); needCopy = true; } restTokens.Add(token); return(needCopy); }
/// <summary> /// Return the list of IIDs /// Used by IInspectable.GetIIDs implementation for every CCW /// </summary> internal static System.Collections.Generic.Internal.List<Guid> GetIIDs(this RuntimeTypeHandle ccwType) { System.Collections.Generic.Internal.List<Guid> iids = new System.Collections.Generic.Internal.List<Guid>(); // Every CCW implements ICPP iids.Add(Interop.COM.IID_ICustomPropertyProvider); // if there isn't any data about this type, just return empty list if (!ccwType.IsSupportCCWTemplate()) return iids; GetIIDsImpl(ccwType, iids); return iids; }