Ejemplo n.º 1
0
        void OnNotifyCallback(IntPtr pContext, uint cNotification, IntPtr lpNotifications)
        {
            EEventMask eventType = (EEventMask)Marshal.ReadInt32(lpNotifications);
            int        intSize   = Marshal.SizeOf(typeof(int));
            IntPtr     sPtr      = lpNotifications + intSize * 2; //ulEventType, ulAlignPad

            switch (eventType)
            {
            case EEventMask.fnevNewMail:
            {
                Console.WriteLine("New mail");
                if (this.OnNewMail == null)
                {
                    break;
                }
                NEWMAIL_NOTIFICATION     notification = (NEWMAIL_NOTIFICATION)Marshal.PtrToStructure(sPtr, typeof(NEWMAIL_NOTIFICATION));
                MsgStoreNewMailEventArgs n            = new MsgStoreNewMailEventArgs(StoreID, notification);
                this.OnNewMail(this, n);
            }
            break;
            }
        }
Ejemplo n.º 2
0
 void OnNotifyCallback(IntPtr pContext, uint cNotification, IntPtr lpNotifications)
 {
     EEventMask eventType = (EEventMask)Marshal.ReadInt32(lpNotifications);
     int intSize = Marshal.SizeOf(typeof(int));
     IntPtr sPtr = lpNotifications + intSize * 2; //ulEventType, ulAlignPad
     switch (eventType)
     {
         case EEventMask.fnevNewMail:
             {
                 Console.WriteLine("New mail");
                 if (this.OnNewMail == null)
                     break;
                 NEWMAIL_NOTIFICATION notification = (NEWMAIL_NOTIFICATION)Marshal.PtrToStructure(sPtr, typeof(NEWMAIL_NOTIFICATION));
                 MsgStoreNewMailEventArgs n = new MsgStoreNewMailEventArgs(StoreID, notification);
                 this.OnNewMail(this, n);
             }
             break;
      }
 }