private void SendCallback(CefEvalJavascriptEvent evalEvent, string result) { CefJavascriptResultEvent resultEvent = new CefJavascriptResultEvent() { InstanceID = InstanceID, CallbackID = evalEvent.CallbackID, Result = result, }; Program.SendEvent(resultEvent); }
public void ReceiveEvent(CefEvent cefEvent) { if (cefEvent is CefInstanceCreatedEvent) { Initialize(); return; } if (cefEvent is CefJavascriptResultEvent) { CefJavascriptResultEvent javascriptEvent = (CefJavascriptResultEvent)cefEvent; _jsCallbacks[javascriptEvent.CallbackID](javascriptEvent.Result); _jsCallbacks.Remove(javascriptEvent.CallbackID); return; } if (cefEvent is CefJavascriptStaticCallEvent) { CefJavascriptStaticCallEvent staticCallEvent = (CefJavascriptStaticCallEvent)cefEvent; try { string result = (string)GetType(staticCallEvent.Namespace).GetMethod(staticCallEvent.Method).Invoke(this, staticCallEvent.Arguments); RespondToStaticCall(staticCallEvent, result); } catch (Exception e) { Debug.LogError(e.Message); Debug.LogError(e.StackTrace); RespondToStaticCall(staticCallEvent, "error"); } return; } }
public void HandleEvent(CefJavascriptResultEvent cefEvent) { _jsCallbacks[cefEvent.CallbackID].ExecuteAsync(cefEvent.Result); _jsCallbacks.Remove(cefEvent.CallbackID); }