void OnActionAdded(FormsWebView sender, string key, bool isGlobal)
 {
     if (isGlobal || (Element != null && Element.Equals(sender)))
     {
         InjectJavascript(WebViewControlDelegate.GenerateFunctionScript(key));
     }
 }
示例#2
0
 void OnActionAdded(FormsWebView sender, string key, bool isGlobal)
 {
     if (isGlobal || sender.Equals(Element))
     {
         InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
     }
 }
示例#3
0
 async void OnActionAdded(FormsWebView sender, string key, bool isGlobal)
 {
     if (isGlobal || Element.Equals(sender))
     {
         await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) });
     }
 }
 private async void OnActionAdded(FormsWebView sender, string key)
 {
     if (Element == sender && Control != null)
     {
         await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) });
     }
 }
示例#5
0
 public void GoForward()
 {
     if (CanGoForward)
     {
         WebViewControlDelegate.NavigateThroughStack(this, true);
     }
 }
示例#6
0
 public void GoBack()
 {
     if (CanGoBack)
     {
         WebViewControlDelegate.NavigateThroughStack(this, false);
     }
 }
示例#7
0
 public static void RegisterGlobalCallback(string name, Action <string> callback)
 {
     if (GlobalRegisteredActions.ContainsKey(name))
     {
         return;
     }
     GlobalRegisteredActions.Add(name, callback);
     WebViewControlDelegate.NotifyCallbacksChanged(null, name, true);
 }
示例#8
0
 public void RegisterLocalCallback(string name, Action <string> callback)
 {
     if (LocalRegisteredActions.ContainsKey(name))
     {
         return;
     }
     LocalRegisteredActions.Add(name, callback);
     WebViewControlDelegate.NotifyCallbacksChanged(this, name, false);
 }
示例#9
0
        public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
        {
            Renderer.InjectJS(WebViewControlDelegate.InjectedFunction);
            foreach (var key in Element.GetAllCallbacks())
            {
                Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
            }

            Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, webView.Url.AbsoluteUrl.ToString()));
        }
示例#10
0
        public override void OnPageFinished(Android.Webkit.WebView view, string url)
        {
            Renderer.InjectJS(WebViewControlDelegate.InjectedFunction);
            foreach (var key in Element.GetAllCallbacks())
            {
                Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
            }

            Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, url));
            base.OnPageFinished(view, url);
        }
        private async void OnContentLoaded(Windows.UI.Xaml.Controls.WebView sender, Windows.UI.Xaml.Controls.WebViewDOMContentLoadedEventArgs args)
        {
            await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.InjectedFunction });

            foreach (var key in Element.GetAllCallbacks())
            {
                await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) });
            }

            Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, args.Uri != null ? args.Uri.AbsoluteUri : ""));
        }
示例#12
0
        public override void OnPageFinished(Android.Webkit.WebView view, string url)
        {
            Renderer.InjectJS(WebViewControlDelegate.InjectedFunction);
            foreach (var key in Element.GetAllCallbacks())
            {
                Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
            }

            Element.SetValue(FormsWebView.UriProperty, url);

            Element.InvokeEvent(WebViewEventType.NavigationComplete, new NavigationCompletedDelegate(Element, url, true));
            base.OnPageFinished(view, url);
        }
        public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
        {
            Renderer.InjectJS(WebViewControlDelegate.InjectedFunction);
            foreach (var key in Element.GetAllCallbacks())
            {
                Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
            }

            if (webView.Url.AbsoluteUrl != null)
            {
                Element.SetValue(FormsWebView.UriProperty, webView.Url.AbsoluteUrl.ToString());
            }

            Element.InvokeEvent(WebViewEventType.NavigationComplete, new NavigationCompletedDelegate(Element, webView.Url.AbsoluteUrl.ToString(), true));
        }
        private async void OnNavigated(Windows.UI.Xaml.Controls.WebView sender, Windows.UI.Xaml.Controls.WebViewNavigationCompletedEventArgs args)
        {
            await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.InjectedFunction });

            foreach (var key in Element.GetAllCallbacks())
            {
                await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) });
            }

            var uri = args.Uri != null ? args.Uri.AbsoluteUri : "";

            Element.SetValue(FormsWebView.UriProperty, uri);

            Element.InvokeEvent(WebViewEventType.NavigationComplete, new NavigationCompletedDelegate(Element, uri));
        }
示例#15
0
        public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
        {
            Renderer.InjectJS(WebViewControlDelegate.InjectedFunction);

            foreach (var key in Element.GetLocalCallbacks())
            {
                Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
            }

            foreach (var key in Element.GetGlobalCallbacks())
            {
                Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
            }

            Element.InvokeEvent(WebViewEventType.NavigationStackUpdate, new NavigationStackUpdateDelegate(Element, Renderer.Control.CanGoBack, Renderer.Control.CanGoForward));
            Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, webView.Url.AbsoluteUrl.ToString()));
        }
示例#16
0
        async void OnContentLoaded(Windows.UI.Xaml.Controls.WebView sender, Windows.UI.Xaml.Controls.WebViewDOMContentLoadedEventArgs args)
        {
            await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.InjectedFunction });

            foreach (var key in Element.GetLocalCallbacks())
            {
                await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) });
            }

            foreach (var key in Element.GetGlobalCallbacks())
            {
                await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) });
            }

            Element.InvokeEvent(WebViewEventType.NavigationStackUpdate, new NavigationStackUpdateDelegate(Element, Control.CanGoBack, Control.CanGoForward));
            Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, args.Uri != null ? args.Uri.AbsoluteUri : ""));
        }
示例#17
0
        public override void OnPageFinished(Android.Webkit.WebView view, string url)
        {
            Element.InvokeEvent(WebViewEventType.NavigationComplete, new NavigationCompletedDelegate(Element, url, true));
            Renderer.InjectJS(WebViewControlDelegate.InjectedFunction);

            foreach (var key in Element.GetGlobalCallbacks())
            {
                Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
            }

            foreach (var key in Element.GetLocalCallbacks())
            {
                Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
            }

            Element.InvokeEvent(WebViewEventType.NavigationStackUpdate, new NavigationStackUpdateDelegate(Element, Renderer.Control.CanGoBack(), Renderer.Control.CanGoForward()));
            Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, url));
            base.OnPageFinished(view, url);
        }
 private void OnActionAdded(FormsWebView sender, string key)
 {
     InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
 }
示例#19
0
 public void InjectJavascript(string js)
 {
     WebViewControlDelegate.InjectJavascript(this, js);
 }