예제 #1
0
        public Tab(Tienda tienda)
        {
            Title = tienda.Nombre;

            MyCustomWebView webView = new MyCustomWebView()
            {
                Source            = tienda.URL,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Margin            = 0
            };

            Grid grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                },
                RowSpacing    = 0,
                ColumnSpacing = 0,
                Padding       = 0, Margin = 0
            };

            grid.Children.Add(webView, 0, 0);
            Content = grid;
        }
예제 #2
0
        public void FindInCurrentTab(ContentPage page, string newUrl)
        {
            MyCustomWebView webview = (page.Content as Grid)?.Children[0] as MyCustomWebView;

            UpdateWebView(webview.Parent as Grid, new UrlWebViewSource {
                Url = newUrl
            });
            WebView = webview;
        }
예제 #3
0
 protected override void OnCurrentPageChanged()
 {
     base.OnCurrentPageChanged();
     try
     {
         if (CurrentPage != null)
         {
             WebView = GetCurrentWebView();
             AddAds();
         }
     }
     catch (Exception e) { }
 }
예제 #4
0
        public MyCustomWebView UpdateWebView(Grid container, UrlWebViewSource newURL)
        {
            MyCustomWebView webView = new MyCustomWebView
            {
                Source = newURL,
                Title  = WebView.Title
            };

            container.Children.Clear();
            container.Children.Add(webView, 0, 0);
            AddAds();

            return(webView);
        }
예제 #5
0
        public async void ShareLinkAsync()
        {
            MyCustomWebView currentWebView = GetCurrentWebView();

            try
            {
                if (currentWebView != null)
                {
                    string title = await currentWebView.EvaluateJavaScriptAsync("document.title;");

                    string lite = !title.Contains("Mantenimiento") ? UtilsXF.RemoveSpecialCharacters(title.Substring(title.LastIndexOf(" - "))) : title;

                    _ = ShareUtils.ShareText(lite, ((UrlWebViewSource)WebView.Source).Url);
                }
            }
            catch (Exception)
            {
                if (currentWebView != null)
                {
                    _ = ShareUtils.ShareText("", ((UrlWebViewSource)WebView.Source).Url);
                }
            }
        }
예제 #6
0
        public void RefreshCurrentWebView(ContentPage page)
        {
            MyCustomWebView webview = (page.Content as Grid).Children[0] as MyCustomWebView;

            webview.Reload();
        }