protected virtual bool OnNewWindowPolicyDecisionRequested(WebFrame frame, NetworkRequest request, WebNavigationAction action, WebPolicyDecision decision) { var val = new Value(GType.Int); var valueArray = new ValueArray(5u); var array = new Value[5]; array [0] = new Value(this); valueArray.Append(array [0]); array [1] = new Value(frame); valueArray.Append(array [1]); array [2] = new Value(request); valueArray.Append(array [2]); array [3] = new Value(action); valueArray.Append(array [3]); array [4] = new Value(decision); valueArray.Append(array [4]); GLib.Object.g_signal_chain_from_overridden(valueArray.ArrayPtr, ref val); var array2 = array; for (int i = 0; i < array2.Length; i++) { var value = array2 [i]; value.Dispose(); } bool result = (bool)val; val.Dispose(); return(result); }
public override void FinishedLoad(WebKit.WebView sender, WebFrame forFrame) { Renderer._sentNavigating = false; if (Renderer.Control.IsLoading) { return; } if (Renderer.Control.MainFrameUrl == $"file://{NSBundle.MainBundle.BundlePath}/") { return; } Renderer._ignoreSourceChanges = true; Renderer.Element?.SetValueFromRenderer(WebView.SourceProperty, new UrlWebViewSource { Url = Renderer.Control.MainFrameUrl }); Renderer._ignoreSourceChanges = false; Renderer._lastEvent = Renderer._lastBackForwardEvent; Renderer.Element?.SendNavigated(new WebNavigatedEventArgs(Renderer._lastEvent, Renderer.Element?.Source, Renderer.Control.MainFrameUrl, WebNavigationResult.Success)); Renderer.UpdateCanGoBackForward(); }
public void FinishedLoad(WebView sender, WebFrame forFrame) { Window.Title = _webView.MainFrameTitle ?? "Sign in"; _progressIndicator.Hidden = true; _progressIndicator.StopAnimation(null); }
private void CreateWebView() { webview = new WebView(); webview.Editable = false; webview.TitleChanged += new TitleChangedHandler(OnTitleChanged); webview.HoveringOverLink += new HoveringOverLinkHandler(OnHoveringOverLink); webview.LoadStatusChanged += delegate { /* * Console.WriteLine (webview.LoadStatus); * IntPtr raw_ret = webkit_web_view_get_main_frame(webview.Handle); * Console.WriteLine ("0x{0:x}", (int)raw_ret); * GLib.ObjectManager.RegisterType (raw_ret, typeof (WebKit.WebFrame)); * WebKit.WebFrame ret = GLib.Object.GetObject(raw_ret) as WebKit.WebFrame; * Console.WriteLine (ret); */ Console.WriteLine(webview.LoadStatus); WebFrame frame = webview.MainFrame; Console.WriteLine(frame); if (frame != null) { Console.WriteLine(frame.Uri); } // if (webview.LoadStatus == LoadStatus.committed) { if (frame != null && !String.IsNullOrEmpty(frame.Uri)) { uri_entry.Text = frame.Uri; } // } }; }
public override void DecidePolicyForNavigation(WebView web_view, NSDictionary action_info, NSUrlRequest request, WebFrame frame, NSObject decision_token) { if (LinkClicked != null) { LinkClicked(request.Url.ToString()); } }
public void StartedProvisionalLoad(WebView sender, WebFrame forFrame) { Console.WriteLine("Load Started:"); InvokeOnMainThread(() => { progress = 0; progressBar.DoubleValue = progress; }); }
public void FinishedLoad(WebView sender, WebFrame forFrame) { Console.WriteLine("Load Finished"); InvokeOnMainThread(() => { progress = 100; progressBar.DoubleValue = progress; }); }
public void FailedLoadWithError(WebView sender, NSError error, WebFrame forFrame) { // Ignore the ""NSURLErrorDomain -999" authentication error with Instagram. Issue #98. if (error.Code != -999) { Authenticator.OnError(error.LocalizedDescription); } }
public override void DecidePolicyForNavigation(WebView web_view, NSDictionary action_info, NSUrlRequest request, WebFrame frame, NSObject decision_token) { string file_path = request.Url.ToString(); file_path = file_path.Replace("%20", " "); NSWorkspace.SharedWorkspace.OpenFile(file_path); }
public void WebFrameConstructor() { tlog.Debug(tag, $"WebFrameConstructor START"); using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai")) { var testingTarget = new WebFrame(webview.SwigCPtr.Handle, false); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <WebFrame>(testingTarget, "Should return WebFrame instance."); testingTarget.Dispose(); } tlog.Debug(tag, $"WebFrameConstructor END (OK)"); }
public void FinishedLoad(WebView sender, WebFrame forFrame) { var url = sender.MainFrameUrl; if (!Authenticator.HasCompleted) { Uri uri; if (Uri.TryCreate(url, UriKind.Absolute, out uri)) { if (Authenticator.CheckUrl(uri, GetCookies(url))) { return; } } } }
public void FinishedLoad(WebView sender, WebFrame frame) { if (!loadingNewPlayer) { Console.WriteLine("Frame loaded!!!"); var playerScriptPath = NSBundle.MainBundle.PathForResource("YoutubePlayer", "js"); var playerScript = NSData.FromFile(playerScriptPath).ToString(NSStringEncoding.UTF8).ToString(); webView.Preferences.JavaScriptEnabled = true; sender.WindowScriptObject.EvaluateWebScript(playerScript.Replace("{{videoId}}", currentTrack.Id)); Play(); loadingNewPlayer = true; return; } loadingNewPlayer = false; }
public void FailedProvisionalLoad(WebView sender, NSError error, WebFrame forFrame) { var url = sender.MainFrameUrl; if (!Authenticator.HasCompleted) { Uri uri; if (Uri.TryCreate(url, UriKind.Absolute, out uri)) { if (Authenticator.CheckUrl(uri, GetCookies(url))) { forFrame.StopLoading(); return; } } } Authenticator.OnError(error.LocalizedDescription); }
public override void FinishedLoad(WebKit.WebView sender, WebFrame forFrame) { _renderer._sentNavigating = false; if (_renderer.Control.IsLoading) { return; } _renderer._ignoreSourceChanges = true; _renderer.Element?.SetValueFromRenderer(WebView.SourceProperty, new UrlWebViewSource { Url = _renderer.Control.MainFrameUrl }); _renderer._ignoreSourceChanges = false; _renderer._lastEvent = _renderer._lastBackForwardEvent; _renderer.Element?.SendNavigated(new WebNavigatedEventArgs(_renderer._lastEvent, _renderer.Element?.Source, _renderer.Control.MainFrameUrl, WebNavigationResult.Success)); _renderer.UpdateCanGoBackForward(); }
public void FailedProvisionalLoad(WebView sender, NSError error, WebFrame forFrame) { var url = sender.MainFrameUrl; if (!Authenticator.HasCompleted) { Uri uri; if (Uri.TryCreate(url, UriKind.Absolute, out uri)) { if (Authenticator.CheckUrl(uri, GetCookies(url))) { forFrame.StopLoading(); return; } } } // Ignore the ""NSURLErrorDomain -999" authentication error with Dropbox. Issue #76. if (error.Code != -999) { Authenticator.OnError(error.LocalizedDescription); } }
public override void FailedLoadWithError(WebKit.WebView sender, NSError error, WebFrame forFrame) { Renderer._sentNavigating = false; Renderer._lastEvent = Renderer._lastBackForwardEvent; Renderer.Element?.SendNavigated(new WebNavigatedEventArgs(Renderer._lastEvent, new UrlWebViewSource { Url = Renderer.Control.MainFrameUrl }, Renderer.Control.MainFrameUrl, WebNavigationResult.Failure)); Renderer.UpdateCanGoBackForward(); }
private T GetControlFromLocator <T>(Locator aLocator) where T : WebControl { WebControl aWebCustomControl = null; if (typeof(T) == typeof(WebButton)) { aWebCustomControl = new WebButton(myBrowser, aLocator); } if (typeof(T) == typeof(WebEditBox)) { aWebCustomControl = new WebEditBox(myBrowser, aLocator); } if (typeof(T) == typeof(WebCalender)) { aWebCustomControl = new WebCalender(myBrowser, aLocator); } if (typeof(T) == typeof(WebCheckBox)) { aWebCustomControl = new WebCheckBox(myBrowser, aLocator); } if (typeof(T) == typeof(WebComboBox)) { aWebCustomControl = new WebComboBox(myBrowser, aLocator); } if (typeof(T) == typeof(WebDialog)) { aWebCustomControl = new WebDialog(myBrowser, aLocator); } if (typeof(T) == typeof(WebFrame)) { aWebCustomControl = new WebFrame(myBrowser, aLocator); } if (typeof(T) == typeof(WebImage)) { aWebCustomControl = new WebImage(myBrowser, aLocator); } if (typeof(T) == typeof(WebLabel)) { aWebCustomControl = new WebLabel(myBrowser, aLocator); } if (typeof(T) == typeof(WebLink)) { aWebCustomControl = new WebLink(myBrowser, aLocator); } if (typeof(T) == typeof(WebListBox)) { aWebCustomControl = new WebListBox(myBrowser, aLocator); } if (typeof(T) == typeof(WebPage)) { aWebCustomControl = new WebPage(myBrowser, aLocator); } if (typeof(T) == typeof(WebRadioButton)) { aWebCustomControl = new WebRadioButton(myBrowser, aLocator); } if (typeof(T) == typeof(WebSpanArea)) { aWebCustomControl = new WebSpanArea(myBrowser, aLocator); } if (typeof(T) == typeof(WebTable)) { aWebCustomControl = new WebTable(myBrowser, aLocator); } if (typeof(T) == typeof(WebControl)) { aWebCustomControl = new WebControl(myBrowser, aLocator); } if (null == aWebCustomControl) { aWebCustomControl = new WebControl(myBrowser, aLocator); } if (aWebCustomControl.IsControlPresent()) { aWebCustomControl.GetControl(); } return((T)aWebCustomControl); }
public override void DecidePolicyForNavigation(WebView webView, NSDictionary actionInformation, NSUrlRequest request, WebFrame frame, NSObject decisionToken) { NSApplication.SharedApplication.InvokeOnMainThread(() => { if (tipWindow.HandleUrlOpen != null && tipWindow.HandleUrlOpen(new Uri(request.Url.AbsoluteString))) { WebView.DecideIgnore(decisionToken); } else { WebView.DecideUse(decisionToken); } }); }
internal JSStub(WebFrame frame, string name) { this.frame = frame; this.name = name; }
public void DecidePolicyForNavigation(WebView webView, NSDictionary actionInformation, NSUrlRequest request, WebFrame frame, NSObject decisionToken) { if (request == null) { WebView.DecideUse(decisionToken); return; } string requestUrlString = request.Url.ToString(); if (requestUrlString.StartsWith(BrokerConstants.BrowserExtPrefix, StringComparison.OrdinalIgnoreCase)) { var result = new AuthorizationResult(AuthorizationStatus.ProtocolError) { Error = "Unsupported request", ErrorDescription = "Server is redirecting client to browser. This behavior is not yet defined on Mac OS X." }; _callbackMethod(result); WebView.DecideIgnore(decisionToken); Close(); return; } if (requestUrlString.ToLower(CultureInfo.InvariantCulture).StartsWith(_callback.ToLower(CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase) || requestUrlString.StartsWith(BrokerConstants.BrowserExtInstallPrefix, StringComparison.OrdinalIgnoreCase)) { _callbackMethod(new AuthorizationResult(AuthorizationStatus.Success, request.Url.ToString())); WebView.DecideIgnore(decisionToken); Close(); return; } if (requestUrlString.StartsWith(BrokerConstants.DeviceAuthChallengeRedirect, StringComparison.CurrentCultureIgnoreCase)) { var uri = new Uri(requestUrlString); string query = uri.Query; if (query.StartsWith("?", StringComparison.OrdinalIgnoreCase)) { query = query.Substring(1); } Dictionary <string, string> keyPair = CoreHelpers.ParseKeyValueList(query, '&', true, false, null); string responseHeader = DeviceAuthHelper.CreateDeviceAuthChallengeResponseAsync(keyPair).Result; var newRequest = (NSMutableUrlRequest)request.MutableCopy(); newRequest.Url = new NSUrl(keyPair["SubmitUrl"]); newRequest[BrokerConstants.ChallengeResponseHeader] = responseHeader; webView.MainFrame.LoadRequest(newRequest); WebView.DecideIgnore(decisionToken); return; } if (!request.Url.AbsoluteString.Equals("about:blank", StringComparison.CurrentCultureIgnoreCase) && !request.Url.Scheme.Equals("https", StringComparison.CurrentCultureIgnoreCase)) { var result = new AuthorizationResult(AuthorizationStatus.ErrorHttp); result.Error = AuthError.NonHttpsRedirectNotSupported; result.ErrorDescription = AuthErrorMessage.NonHttpsRedirectNotSupported; _callbackMethod(result); WebView.DecideIgnore(decisionToken); Close(); } WebView.DecideUse(decisionToken); }
public override void DecidePolicyForNavigation(WebView web_view, NSDictionary action_info, NSUrlRequest request, WebFrame frame, NSObject decision_token) { SparkleEventLogController.LinkClicked(request.Url.ToString()); }
private void WebViewDidReceiveTitleForFrame(WebView sender, NSString title, WebFrame frame) { this.window.Title = title; }
public void FailedLoadWithError(WebView sender, NSError error, WebFrame forFrame) { Console.WriteLine("Load Failed: {0}", error.Description); }
private void WebViewDidStartProvisionalLoadForFrame(WebView sender, WebFrame frame) { this.indicator.IsHidden = false; this.indicator.StartAnimation(null); }
internal static WebControl GetWebControlFromIContol(IControl aControl, Browser aBrowser, Locator aLocator, ControlType aConrolType) { WebControl aWebControl = null; if (aConrolType == ControlType.Button) { WebButton aWebButton = new WebButton(aBrowser, aLocator); aWebButton.Control = aControl; aWebControl = aWebButton; } if (aConrolType == ControlType.EditBox) { WebEditBox aWebEditBox = new WebEditBox(aBrowser, aLocator); aWebEditBox.Control = aControl; aWebControl = aWebEditBox; } if (aConrolType == ControlType.Custom) { aWebControl = new WebControl(aBrowser, aLocator); aWebControl.Control = aControl; //aWebControl = aWebEditBox; } if (aConrolType == ControlType.Calender) { WebCalender aWebCalender = new WebCalender(aBrowser, aLocator); aWebCalender.Control = aControl; aWebControl = aWebCalender; } if (aConrolType == ControlType.ComboBox) { WebComboBox aWebComboBox = new WebComboBox(aBrowser, aLocator); aWebComboBox.Control = aControl; aWebControl = aWebComboBox; } if (aConrolType == ControlType.CheckBox) { WebCheckBox aWebCheckBox = new WebCheckBox(aBrowser, aLocator); aWebCheckBox.Control = aControl; aWebControl = aWebCheckBox; } if (aConrolType == ControlType.Dialog) { WebDialog aWebDialog = new WebDialog(aBrowser, aLocator); aWebDialog.Control = aControl; aWebControl = aWebDialog; } if (aConrolType == ControlType.Frame) { WebFrame aWebFrame = new WebFrame(aBrowser, aLocator); aWebFrame.Control = aControl; aWebControl = aWebFrame; } if (aConrolType == ControlType.Image) { WebImage aWebImage = new WebImage(aBrowser, aLocator); aWebImage.Control = aControl; aWebControl = aWebImage; } if (aConrolType == ControlType.Label) { WebLabel aWebLabel = new WebLabel(aBrowser, aLocator); aWebLabel.Control = aControl; aWebControl = aWebLabel; } if (aConrolType == ControlType.Link) { WebLink aWebLink = new WebLink(aBrowser, aLocator); aWebLink.Control = aControl; aWebControl = aWebLink; } if (aConrolType == ControlType.ListBox) { WebListBox aWebListBox = new WebListBox(aBrowser, aLocator); aWebListBox.Control = aControl; aWebControl = aWebListBox; } if (aConrolType == ControlType.Page) { WebPage aWebPage = new WebPage(aBrowser, aLocator); aWebPage.Control = aControl; aWebControl = aWebPage; } if (aConrolType == ControlType.RadioButton) { WebRadioButton aWebRadioButton = new WebRadioButton(aBrowser, aLocator); aWebRadioButton.Control = aControl; aWebControl = aWebRadioButton; } if (aConrolType == ControlType.SpanArea) { WebSpanArea aWebSpanArea = new WebSpanArea(aBrowser, aLocator); aWebSpanArea.Control = aControl; aWebControl = aWebSpanArea; } if (aConrolType == ControlType.WebTable) { WebTable aWebTable = new WebTable(aBrowser, aLocator); aWebTable.Control = aControl; aWebControl = aWebTable; } if (aConrolType == ControlType.WebRow) { WebRow aWebRow = new WebRow(aBrowser, aLocator); aWebRow.Control = aControl; aWebControl = aWebRow; } if (aConrolType == ControlType.WebCell) { WebCell aWebCell = new WebCell(aBrowser, aLocator); aWebCell.Control = aControl; aWebControl = aWebCell; } return(aWebControl); }
// Ref: http://www.c-sharpcorner.com/UploadFile/mahesh/using-xaml-frame-in-wpf857/ private void Window_Loaded(object sender, RoutedEventArgs e) { // Can raise an exception, hanlded in dispatcher WebFrame.Navigate(new System.Uri("http://www.totalimagine.com/Service/MyCourse/", UriKind.Absolute)); }
public override void DecidePolicyForNavigation( WebView webView, NSDictionary actionInformation, NSUrlRequest request, WebFrame frame, NSObject decisionToken) { if (!initialNavigationPerformed) { WebView.DecideUse(decisionToken); initialNavigationPerformed = true; return; } var originalRequestUrl = (NSUrl)actionInformation [WebActionOriginalUrlKey]; if (originalRequestUrl.Scheme == "data") { WebView.DecideUse(decisionToken); return; } // Let iframes do their own navigation handling. if (frame != webView.MainFrame) { if (originalRequestUrl.Scheme == "about") { WebView.DecideUse(decisionToken); } else { NSWorkspace.SharedWorkspace.OpenUrl(originalRequestUrl); WebView.DecideIgnore(decisionToken); } return; } if (ScrollToElementWithId(webView, request.Url.Fragment)) { WebView.DecideIgnore(decisionToken); return; } NSUrl workspaceUrl = null; try { var resourceAction = ClientApp .SharedInstance .WebServer .TryGetLocalResourcePath( originalRequestUrl, out var localPath); switch (resourceAction) { case ClientWebServer.ResourceAction.WorkbookResource: workspaceUrl = NSUrl.FromFilename(localPath); break; case ClientWebServer.ResourceAction.ExternalResource: workspaceUrl = originalRequestUrl; break; } } catch { workspaceUrl = originalRequestUrl; } if (workspaceUrl != null) { NSWorkspace.SharedWorkspace.OpenUrl(workspaceUrl); } WebView.DecideIgnore(decisionToken); }
public override void DecidePolicyForNavigation(WebView webView, NSDictionary actionInformation, NSUrlRequest request, WebFrame frame, NSObject decisionToken) { switch ((WebNavigationType)((NSNumber)actionInformation [WebPolicyDelegate.WebActionNavigationTypeKey]).Int32Value) { case WebNavigationType.BackForward: case WebNavigationType.FormResubmitted: case WebNavigationType.FormSubmitted: WebPolicyDelegate.DecideIgnore(decisionToken); break; case WebNavigationType.LinkClicked: NSWorkspace.SharedWorkspace.OpenUrl(actionInformation[WebPolicyDelegate.WebActionOriginalUrlKey] as NSUrl); WebPolicyDelegate.DecideIgnore(decisionToken); break; case WebNavigationType.Other: case WebNavigationType.Reload: WebPolicyDelegate.DecideUse(decisionToken); break; } }
public override void FailedProvisionalLoad(WebKit.WebView sender, NSError error, WebFrame forFrame) { FailedLoadWithError(sender, error, forFrame); }
public override void FinishedLoad(WebView sender, WebFrame forFrame) { viewController.LoadFinished("FinishedLoad"); }
public void FailedLoadWithError(WebView sender, NSError error, WebFrame forFrame) { Authenticator.OnError(error.LocalizedDescription); }
public override void FinishedLoad(WebView sender, WebFrame forFrame) { document.ReloadDocument(); }
private void WebViewDidFinishLoadForFrame(WebView sender, WebFrame frame) { this.indicator.StopAnimation(null); this.indicator.IsHidden = true; }