Exemplo n.º 1
0
 private static SensLogonEventHandler UnregisterEvent(SensLogonEventHandler original,
                                                      SensLogonEventHandler oldDel)
 {
     original = original - oldDel;
     if (original == null)
     {
         registerCount--;
         if (registerCount == 0)
         {
             //unregister for those events.
             SensLogon.eventCatcher.Dispose();
             SensLogon.eventCatcher = null;
         }
     }
     return(original);
 }
Exemplo n.º 2
0
        private static SensLogonEventHandler RegisterEvent(SensLogonEventHandler original,
                                                           SensLogonEventHandler newDel)
        {
            bool shouldRegister = (original == null);

            original = original + newDel;
            if (shouldRegister)
            {
                if (registerCount <= 0)
                {
                    if (SensLogon.eventCatcher == null)
                    {
                        SensLogon.eventCatcher = new SensLogonInterop();
                    }
                    registerCount = 1;
                }
                else
                {
                    //Just count them.
                    registerCount++;
                }
            }
            return(original);
        }