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; } }
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; } }