internal static void ProcessEvents() { IntPtr dispatcherTarget = API.GetEventDispatcherTarget(); while (true) { IntPtr outEvent; switch (API.ReceiveNextEvent(0U, IntPtr.Zero, 0.0, true, out outEvent)) { case OSStatus.EventLoopTimedOut: goto label_8; case OSStatus.NoError: if (!(outEvent == IntPtr.Zero)) { try { API.SendEventToEventTarget(outEvent, dispatcherTarget); } catch (ExecutionEngineException ex) { Console.Error.WriteLine("ExecutionEngineException caught."); Console.Error.WriteLine("theEvent: " + new EventInfo(outEvent).ToString()); Console.Error.WriteLine(ex.Message); Console.Error.WriteLine(ex.StackTrace); } API.ReleaseEvent(outEvent); continue; } else { goto label_3; } default: goto label_2; } } label_8: return; label_2: return; label_3 :; }