Ejemplo n.º 1
0
            internal static void AddEventHandler <T>(Func <T, EventRegistrationToken> addMethod, Action <EventRegistrationToken> removeMethod, T handler)
            {
                Dictionary <object, WindowsRuntimeMarshal.EventRegistrationTokenList> registrationTokenTable = WindowsRuntimeMarshal.ManagedEventRegistrationImpl.GetEventRegistrationTokenTable(removeMethod.Target, removeMethod);
                EventRegistrationToken token = addMethod(handler);

                lock (registrationTokenTable)
                {
                    WindowsRuntimeMarshal.EventRegistrationTokenList local_4;
                    if (!registrationTokenTable.TryGetValue((object)handler, out local_4))
                    {
                        local_4 = new WindowsRuntimeMarshal.EventRegistrationTokenList(token);
                        registrationTokenTable[(object)handler] = local_4;
                    }
                    else
                    {
                        if (!local_4.Push(token))
                        {
                            return;
                        }
                        registrationTokenTable[(object)handler] = local_4;
                    }
                }
            }
Ejemplo n.º 2
0
 internal EventRegistrationTokenListWithCount(WindowsRuntimeMarshal.NativeOrStaticEventRegistrationImpl.TokenListCount tokenListCount, EventRegistrationToken token)
 {
     this._tokenListCount = tokenListCount;
     this._tokenListCount.Inc();
     this._tokenList = new WindowsRuntimeMarshal.EventRegistrationTokenList(token);
 }
Ejemplo n.º 3
0
 internal EventRegistrationTokenList(WindowsRuntimeMarshal.EventRegistrationTokenList list)
 {
     this.firstToken = list.firstToken;
     this.restTokens = list.restTokens;
 }