void OnActionAdded(FormsWebView sender, string key, bool isGlobal)
 {
     if (isGlobal || (Element != null && Element.Equals(sender)))
     {
         InjectJavascript(WebViewControlDelegate.GenerateFunctionScript(key));
     }
 }
Ejemplo n.º 2
0
 void OnActionAdded(FormsWebView sender, string key, bool isGlobal)
 {
     if (isGlobal || sender.Equals(Element))
     {
         InjectJS(WebViewControlDelegate.GenerateFunctionScript(key));
     }
 }
Ejemplo n.º 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) });
     }
 }
Ejemplo n.º 5
0
 public void GoForward()
 {
     if (CanGoForward)
     {
         WebViewControlDelegate.NavigateThroughStack(this, true);
     }
 }
Ejemplo n.º 6
0
 public void GoBack()
 {
     if (CanGoBack)
     {
         WebViewControlDelegate.NavigateThroughStack(this, false);
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 8
0
 public void RegisterLocalCallback(string name, Action <string> callback)
 {
     if (LocalRegisteredActions.ContainsKey(name))
     {
         return;
     }
     LocalRegisteredActions.Add(name, callback);
     WebViewControlDelegate.NotifyCallbacksChanged(this, name, false);
 }
Ejemplo n.º 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()));
        }
Ejemplo n.º 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 : ""));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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()));
        }
Ejemplo n.º 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 : ""));
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 19
0
 public void InjectJavascript(string js)
 {
     WebViewControlDelegate.InjectJavascript(this, js);
 }