Пример #1
0
        /// <summary>
        /// Navigates to the specified Url.
        /// </summary>
        /// <param name="Url">Url to navigate to.</param>
        public void Navigate(string Url)
        {
            if (loaded)
            {
                // prepend with "http://" if url not well formed
                if (!Uri.IsWellFormedUriString(Url, UriKind.Absolute))
                {
                    Url = "http://" + Url;
                }

                activationContext.Activate();

                WebMutableURLRequest request = new WebMutableURLRequestClass();
                request.initWithURL(Url, _WebURLRequestCachePolicy.WebURLRequestUseProtocolCachePolicy, 60);
                request.setHTTPMethod("GET");

                webView.mainFrame().loadRequest(request);

                activationContext.Deactivate();
            }
            else
            {
                initialUrl = Url == "" ? null : new Uri(Url);
            }
        }
Пример #2
0
        /// <summary>
        /// Navigates to the specified Url.
        /// </summary>
        /// <param name="url">Url to navigate to.</param>
        public void Navigate(string url)
        {
            if (loaded)
            {
                // prepend with "http://" if url not well formed
                if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
                {
                    url = "http://" + url;
                }

                activationContext.Activate();

                WebMutableURLRequest request = new WebMutableURLRequestClass();
                request.initWithURL(url, _WebURLRequestCachePolicy.WebURLRequestUseProtocolCachePolicy, 60);
                request.setHTTPMethod("GET");

                //use basic authentication if username and password are supplied.
                if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password))
                {
                    request.setValue("Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(
                                                                           string.Format("{0}:{1}", UserName, Password))), "Authorization");
                }

                webView.mainFrame().loadRequest((WebURLRequest)request);

                activationContext.Deactivate();
            }
            else
            {
                initialUrl = url.Length == 0 ? null : new Uri(url);
            }
        }
Пример #3
0
        /// <summary>
        /// Navigates to the specified Url.
        /// </summary>
        /// <param name="url">Url to navigate to.</param>
        public void Navigate(string url)
        {
            if (loaded)
            {
                // prepend with "http://" if url not well formed
                if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
                    if (!url.StartsWith("http://") && !url.StartsWith("https://")) /* {@@} */
                        url = "http://" + url;

                activationContext.Activate();

                WebMutableURLRequest request = new WebMutableURLRequestClass();
                request.initWithURL(url, _WebURLRequestCachePolicy.WebURLRequestUseProtocolCachePolicy, 60);
                request.setHTTPMethod("GET");

                //use basic authentication if username and password are supplied.
                if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password))
                    request.setValue("Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(
                        string.Format("{0}:{1}", UserName, Password))), "Authorization");

                webView.mainFrame().loadRequest((WebURLRequest)request);

                activationContext.Deactivate();
            }
            else
            {
                initialUrl = url.Length == 0 ? null : new Uri(url);
            }
        }
Пример #4
0
        /// <summary>
        /// Navigates to the specified Url.
        /// </summary>
        /// <param name="Url">Url to navigate to.</param>
        public void Navigate(string Url)
        {
            if (loaded)
            {
                // prepend with "http://" if url not well formed
                if (!Uri.IsWellFormedUriString(Url, UriKind.Absolute))
                    Url = "http://" + Url;

                activationContext.Activate();

                WebMutableURLRequest request = new WebMutableURLRequestClass();
                request.initWithURL(Url, _WebURLRequestCachePolicy.WebURLRequestUseProtocolCachePolicy, 60);
                request.setHTTPMethod("GET");

                webView.mainFrame().loadRequest(request);

                activationContext.Deactivate();
            }
            else
            {
                initialUrl = Url == "" ? null : new Uri(Url);
            }
        }
Пример #5
0
        /// <summary>
        /// Navigates to the specified Url.
        /// </summary>
        /// <param name="url">Url to navigate to.</param>
        public void Navigate(string url)
        {
            if (loaded)
            {
                // prepend with "http://" if url not well formed
                if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
                    url = "http://" + url;

                activationContext.Activate();

                WebMutableURLRequest request = new WebMutableURLRequestClass();
                request.initWithURL(url, _WebURLRequestCachePolicy.WebURLRequestReloadIgnoringCacheData, 60);
                request.setHTTPMethod("GET");

                //use basic authentication if username and password are supplied.
                if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password))
                    request.setValue("Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(
                        string.Format("{0}:{1}", UserName, Password))), "Authorization");

                webView.mainFrame().loadRequest((WebURLRequest)request);

                WebPreferences p = webView.preferences();
                p.setMinimumFontSize(16);
                p.setFontSmoothing(FontSmoothingType.FontSmoothingTypeWindows);

                activationContext.Deactivate();
            }
            else
            {
                initialUrl = url.Length == 0 ? null : new Uri(url);
            }
        }