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; }
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; }
protected override void OnCurrentPageChanged() { base.OnCurrentPageChanged(); try { if (CurrentPage != null) { WebView = GetCurrentWebView(); AddAds(); } } catch (Exception e) { } }
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); }
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); } } }
public void RefreshCurrentWebView(ContentPage page) { MyCustomWebView webview = (page.Content as Grid).Children[0] as MyCustomWebView; webview.Reload(); }