Exemplo n.º 1
0
        public IosWebView(WebView view) : base(view.GetFrame(), new WKWebViewConfiguration())
        {
            View = view;

            view.AllowsInlineMediaPlaybackChanged.HandleOn(Thread.UI, OnAllowsInlineMediaPlaybackChanged);
            View.SourceChanged.HandleActionOn(Thread.UI, Refresh);
            View.EvaluatedJavascript          = script => Thread.UI.Run(() => RunJavascript(script));
            View.EvaluatedJavascriptFunction += (s, a) => Thread.UI.Run(() => EvaluateJavascriptFunction(s, a));
            Refresh();
            NavigationDelegate = new IosWebViewNavigationDelegate(View);
        }
Exemplo n.º 2
0
        public IosWebView(WebView view, WebViewConfiguration configuration) : base(view.GetFrame(), new WKWebViewConfiguration {
            AllowsInlineMediaPlayback = configuration.AllowsInlineMediaPlayback, MediaTypesRequiringUserActionForPlayback = configuration.MediaTypesRequiringUserActionForPlayback?WKAudiovisualMediaTypes.All:WKAudiovisualMediaTypes.None
        })
        {
            View = view;

            View.ScrollBouncesChanged.HandleOnUI(OnScrollBouncesChanged);
            View.SourceChanged.HandleOnUI(Refresh);
            View.EvaluatedJavascript       = script => Thread.UI.Run(() => RunJavascript(script));
            View.InvokeJavascriptFunction += (s, a) => Thread.UI.Run(() => EvaluateJavascriptFunction(s, a));
            Refresh();
            NavigationDelegate = new IosWebViewNavigationDelegate(View);
        }