protected void ControlOnNavigating(object sender, NavigatingEventArgs navigatingEventArgs) { CookieWebView.OnNavigating(new CookieNavigationEventArgs() { Url = navigatingEventArgs.Uri.ToString() }); }
// use to register runtime dependencies, and hold an instance (thread-safe) public void Register(CookieWebView webView, string mainUrlPath, bool disposeExisting = true) { if (webView == null) { throw new ArgumentNullException(nameof(webView)); } if (mainUrlPath == null) { throw new ArgumentNullException(nameof(mainUrlPath)); } rwLock.EnterWriteLock(); try { // existing instance must be disposed, if disposable if (disposeExisting && instance is IDisposable disposable) { disposable.Dispose(); } instance = Container.Resolve <IDijnetBrowser>(nameof(DijnetBrowserFactory), new ParameterOverride(typeof(WebView), webView), new ParameterOverride(typeof(string), mainUrlPath)); registered = true; } finally { rwLock.ExitWriteLock(); } }
private void LoadAllCookies(CookieWebView element) { foreach (Cookie cookie in element.Cookies) { cookieManager.SetCookie(cookie.Domain, $"{cookie.Name}={cookie.Value}"); } }
private async Task LoadAllCookiesAsync(CookieWebView element) { foreach (Cookie cookie in element.Cookies) { await cookieStore.SetCookieAsync(new NSHttpCookie(cookie)); } }
protected void ControlOnNavigated(object sender, System.Windows.Navigation.NavigationEventArgs navigationEventArgs) { CookieWebView.OnNavigated(new CookieNavigatedEventArgs() { Cookies = Control.GetCookies(), Url = navigationEventArgs.Uri.ToString() }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); CookieWebView web = new CookieWebView { Source = "https://read.amazon.com/notebook", HeightRequest = (int)(Resources.DisplayMetrics.HeightPixels * .90), }; MyNotes.DeviceDetails myDevice = new MyNotes.DeviceDetails(Resources.DisplayMetrics.HeightPixels, Resources.DisplayMetrics.WidthPixels); LoadApplication(new App(myDevice, web)); }
public App() { _label = new Label { HorizontalOptions = LayoutOptions.Center, Text = "Loading..." }; var webView = new CookieWebView { Source = new UrlWebViewSource { Url = "http://dfwmobile.net" }, VerticalOptions = LayoutOptions.FillAndExpand }; var refreshButton = new Button { Text = "Refresh" }; refreshButton.Clicked += (sender, args) => { webView.Source = new UrlWebViewSource { Url = "http://dfwmobile.net" }; }; var cookieCountText = new Label { Text = "0" }; var toolbarLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { refreshButton, cookieCountText } }; webView.Navigated += (sender, args) => { Debug.WriteLine("Finished navigation to: {0}, Cookies: {1}", args.Url, args.Cookies.Count); cookieCountText.Text = args.Cookies.Count.ToString(); _label.Text = args.Url; }; webView.Navigating += (sender, args) => { Debug.WriteLine("Navigating to: {0}", args.Url); _label.Text = args.Url; }; MainPage = new ContentPage { Content = new StackLayout { Orientation = StackOrientation.Vertical, Children = { _label, toolbarLayout, webView } } }; }
internal CookieWebViewClient(CookieWebView cookieWebView) { _cookieWebView = cookieWebView; }
public WebViewDelegate(CookieWebView cookieWebView) { _cookieWebView = cookieWebView; }
public App() { _label = new Label { HorizontalOptions = LayoutOptions.Center, Text = "Loading..." }; var webView = new CookieWebView { Source = new UrlWebViewSource { Url = "http://dfwmobile.net" }, VerticalOptions = LayoutOptions.FillAndExpand }; var refreshButton = new Button { Text = "Refresh" }; refreshButton.Clicked += (sender, args) => { webView.Source = new UrlWebViewSource { Url = "http://dfwmobile.net" }; }; var cookieCountText = new Label { Text = "0" }; var toolbarLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { refreshButton, cookieCountText } }; webView.Navigated += (sender, args) => { Debug.WriteLine("Finished navigation to: {0}, Cookies: {1}", args.Url, args.Cookies.Count); cookieCountText.Text = args.Cookies.Count.ToString(); _label.Text = args.Url; }; webView.Navigating += (sender, args) => { Debug.WriteLine("Navigating to: {0}", args.Url); _label.Text = args.Url; }; MainPage = new ContentPage { Content = new StackLayout { Orientation = StackOrientation.Vertical, Children = { _label, toolbarLayout, webView } } }; }