private void OnHandleMessage(object sender, Var varMessage) { if (!varMessage.IsInt) { Console.WriteLine("Unexpected message."); } PPMouseCursorType cursor = (PPMouseCursorType)varMessage.AsInt(); if (cursor == PPMouseCursorType.Custom) { var hotSpot = new PPPoint(16, 16); SetCursor(cursor, customCursor, hotSpot); } else { SetCursor(cursor); } }
/// Handler for messages coming in from the browser via postMessage(). The /// @a var_message will contain the requested delay time. /// /// @param[in] var_message The message posted by the browser. private void OnReceiveMessage(object sender, Var message) { int delay = message.AsInt(); if (delay > 0) { action = DelayedPost; //action = delegate (PPError result) { DelayedPost(result); }; //action = e => DelayedPost(e); // If a delay is requested, issue a callback after delay ms. lastReceiveTime = Core.TimeTicks; Core.CallOnMainThread(action, delay); } else { // If no delay is requested, reply immediately with zero time elapsed. PostMessage(0); } }