Ejemplo n.º 1
0
        /// <summary>
        /// Navigates webview to the given content.
        /// </summary>
        /// <param name="webviewContent">The content to navigate to.</param>
        /// <remarks>Content can be a UrlContent, HtmlContent or WebhostContent</remarks>
        /// <returns>The webview object for a fluent api.</returns>
        public Webview Navigate(IWebviewContent webviewContent)
        {
            var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

            // Only check the loopback exceptions once, if the url routes to the localhsot
            // We want to avoid the check on each navigation!
            // If the current url is not routing to the localhost, the check will return 'null'
            if (isWindows && _loopbackEnabled == null)
            {
                _loopbackEnabled = CheckLoopbackException(webviewContent.ToWebviewUrl());
            }
            if (isWindows && _loopbackEnabled != null && !_loopbackEnabled.Value)
            {
                Bindings.webview_navigate(_nativeWebview, new HtmlContent("Loopback not enabled!").ToWebviewUrl());
            }
            else
            {
                Bindings.webview_navigate(_nativeWebview, webviewContent.ToWebviewUrl());
            }
            return(this);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Navigates webview to the given content.
 /// </summary>
 /// <param name="webviewContent">The content to navigate to.</param>
 /// <remarks>Content can be a UrlContent, HtmlContent or WebhostContent</remarks>
 /// <returns>The webview object for a fluent api.</returns>
 public Webview Navigate(IWebviewContent webviewContent)
 {
     Bindings.webview_navigate(_nativeWebview, webviewContent.ToWebviewUrl());
     return(this);
 }