Exemplo n.º 1
0
        public async override void OnPageFinished(WebView view, string url)
        {
            try
            {
                _webView = view;
                if (_xwebView != null)
                {
                    view.Settings.JavaScriptEnabled = true;
                    await Task.Delay(100);

                    string result = await _xwebView.EvaluateJavaScriptAsync("(function(){return document.body.scrollHeight;})()");

                    _xwebView.HeightRequest = Convert.ToDouble(result);



                    MessagingCenter.Send <Object, PassModel>(this, "LoadFinished", new PassModel(_xwebView.Id, Convert.ToDouble(result)));
                }
                base.OnPageFinished(view, url);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");
            }
        }
Exemplo n.º 2
0
        private void WebView_Loaded(object sender, EventArgs e)
        {
            _webView.EvaluateJavaScriptAsync($"showCaptcha(\"{AppId}\")").Fire();

            //TODO: 如果RegisterAction放在构造函数里,再次显示Dialog时,不会加载
            _webView.RegisterCSharpAction(CaptchaCallback);
        }