Beispiel #1
0
        private void AddPageScript(string script)
        {
            if (_addedInvokerScripts)
            {
                return;
            }

            Publish(CdpApi.AddScript(script), (r, rs) =>
            {
                Publish(CdpApi.EvalMsg(script), (r1, rs1) =>
                {
                    foreach (var name in _routeService.GetBindingRoutes())
                    {
                        Publish(CdpApi.AddBinding(name), (r2, rs2) => Publish(CdpApi.EvalMsg($"bindCode('{name}');")));
                    }
                    _addedInvokerScripts = true;
                });
            });
        }
Beispiel #2
0
        private void HandleActionResult(ActionResult result)
        {
            switch (result)
            {
            case NavigateResult nr:
            {
                Publish(CdpApi.Navigate(nr.Url.ToString()),
                        (pr, px) =>
                    {
                        Publish(CdpApi.SetWindowBounds(_cdpWindowId, nr.Width, nr.Height));
                        AddPageScript(CdpApi.Scripts.GetInvokerScript());
                    });
                break;
            }

            case BindingResult jr:
            {
                Publish(CdpApi.EvalMsg(CdpApi.Scripts.GetEvalRequest(jr)));
                break;
            }
            }
        }