Example #1
0
 static void WatchMsg()
 {
     NativeMethods.MSG msg = new NativeMethods.MSG();
     while (NativeMethods.GetMessage(ref msg, IntPtr.Zero, 0, 0))
     {
         lock (uiInvokeListLock_)
         {
             if (uiInvokeList_.Count > 0)
             {
                 foreach (var action in uiInvokeList_)
                 {
                     action();
                 }
                 uiInvokeList_.Clear();
             }
         }
         NativeMethods.TranslateMessage(ref msg);
         NativeMethods.DispatchMessage(ref msg);
     }
 }
Example #2
0
 public static void DoEvent()
 {
     if (IsMainTask())
     {
         lock (uiInvokeListLock_)
         {
             if (uiInvokeList_.Count > 0)
             {
                 foreach (var action in uiInvokeList_)
                 {
                     action();
                 }
                 uiInvokeList_.Clear();
             }
         }
     }
     UIInvoke(() => {
         NativeMethods.MSG msg = new NativeMethods.MSG();
         NativeMethods.GetMessage(ref msg, IntPtr.Zero, 0, 0);
         NativeMethods.TranslateMessage(ref msg);
         NativeMethods.DispatchMessage(ref msg);
     });
 }