예제 #1
0
        public static void OpenUrl(string url, bool external)
        {
            if (Earth3d.TouchKiosk)
            {
                return;
            }

            if (url.ToLower().Contains("layerapi.aspx"))
            {
                WebClient layerClient = new WebClient();
                layerClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(layerClient_DownloadStringCompleted);
                layerClient.DownloadStringAsync(new Uri(url));
                return;
            }


            if (Properties.Settings.Default.ShowLinksInFullBrowser)
            {
                external = true;
            }

            if (url.ToLower().EndsWith("&wwtfull"))
            {
                url      = url.Substring(0, url.ToLower().LastIndexOf("&wwtfull"));
                external = true;
            }

            if (url.ToLower().Contains("wwtfull=true"))
            {
                external = true;
            }

            url.Replace("&wwtfull=true", "");
            url.Replace("?wwtfull=true", "");
            url.Replace("&wwtfull", "");
            url.Replace("?wwtfull", "");

            if (external)
            {
                try
                {
                    System.Diagnostics.Process.Start(url);
                }
                catch
                {
                }
            }
            else
            {
                WebWindow ww = new WebWindow();

                if (url.ToLower().Contains("worldwidetelescope.org"))
                {
                    ww.Width = 1250;
                }
                ww.Url = url;
                ww.Show();
                ww.allowFullBrowser = true;
            }
        }
예제 #2
0
        public static void OpenHtmlString(string html)
        {
            WebWindow ww = new WebWindow();
            //string style = "<style type=\"text/css\">@import url(\"http://stc.msn.com/br/hp/en-us/css/38/ushpw.css\");@import url(\"http://stc.msn.com/br/hp/en-us/css/38/ovrN.css\");</style>";
            string style = "<style> a.nav:link {color: #ffffff; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                           "a.nav:visited {color: #FFFFFF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none; }\n" +
                           "a.nav:active {color: #FFFFFF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                           "a.nav:hover { color: #FFFF00; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                           "a.nav2:link {color: #0000FF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;} \n" +
                           "a.nav2:visited {color: #0000FF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none; }\n" +
                           "a.nav2:active {color: #0000FF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                           "a.nav2:hover { color: #FF0000; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                           "a:link {color: #FF0000; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;} \n" +
                           "a:visited {color: #FF0000;  font-weight: bold; text-decoration : none; }\n" +
                           "a:active {color: #FF0000;  font-weight: bold; text-decoration : none;}\n" +
                           "a:hover { color: #0000FF;  font-weight: bold; text-decoration : none;}\n" +
                           "body\n" +
                           "{\n" +
                           "     font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 9pt;\n" +
                           "}\n" +
                           "p {\n" +
                           "\n" +
                           "    margin-bottom: 6pt;\n" +
                           "    font-size: 9pt;\n" +
                           "} \n" +
                           "h1 \n" +
                           "{\n" +
                           "    color: #800000;\n" +
                           "    font-size: 12pt;\n" +
                           "}\n" +
                           "li\n" +
                           "{\n" +
                           "    font-size: 9pt;\n" +
                           "}</style>";

            ww.HtmlContent = "<html>" + style + html + "</html>";
            //ww.HtmlContent = "<html>"  + html + "</html>";
            ww.WebAutoSize       = true;
            ww.AutoClose         = true;
            Earth3d.NoStealFocus = true;
            ww.Show();
            ww.Activate();
        }
 public static void OpenHtmlString(string html)
 {
     WebWindow ww = new WebWindow();
     //string style = "<style type=\"text/css\">@import url(\"http://stc.msn.com/br/hp/en-us/css/38/ushpw.css\");@import url(\"http://stc.msn.com/br/hp/en-us/css/38/ovrN.css\");</style>";
     string style = "<style> a.nav:link {color: #ffffff; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n"+
                     "a.nav:visited {color: #FFFFFF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none; }\n"+
                     "a.nav:active {color: #FFFFFF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                     "a.nav:hover { color: #FFFF00; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                     "a.nav2:link {color: #0000FF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;} \n" +
                     "a.nav2:visited {color: #0000FF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none; }\n" +
                     "a.nav2:active {color: #0000FF; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                     "a.nav2:hover { color: #FF0000; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;}\n" +
                     "a:link {color: #FF0000; font-family: Arial; font-size: 9pt; font-weight: bold; text-decoration : none;} \n" +
                     "a:visited {color: #FF0000;  font-weight: bold; text-decoration : none; }\n" +
                     "a:active {color: #FF0000;  font-weight: bold; text-decoration : none;}\n" +
                     "a:hover { color: #0000FF;  font-weight: bold; text-decoration : none;}\n" +
                     "body\n" +
                     "{\n" +
                     "     font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 9pt;\n" +
                     "}\n" +
                     "p {\n" +
                     "\n" +
                     "    margin-bottom: 6pt;\n" +
                     "    font-size: 9pt;\n" +
                     "} \n" +
                     "h1 \n" +
                     "{\n" +
                     "    color: #800000;\n" +
                     "    font-size: 12pt;\n" +
                     "}\n" +
                     "li\n" +
                     "{\n" +
                     "    font-size: 9pt;\n" +
                     "}</style>";
     ww.HtmlContent = "<html>" + style + html + "</html>";
     //ww.HtmlContent = "<html>"  + html + "</html>";
     ww.WebAutoSize = true;
     ww.AutoClose = true;
     Earth3d.NoStealFocus = true;
     ww.Show();
     ww.Activate();
 }
        public static void OpenUrl(string url, bool external)
        {
            if (Earth3d.TouchKiosk)
            {
                return;
            }

            if (url.ToLower().Contains("layerapi.aspx"))
            {
                WebClient layerClient = new WebClient();
                layerClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(layerClient_DownloadStringCompleted);
                layerClient.DownloadStringAsync(new Uri(url));
                return;
            }

            if (Properties.Settings.Default.ShowLinksInFullBrowser)
            {
                external = true;
            }

            if (url.ToLower().EndsWith("&wwtfull"))
            {
                url = url.Substring(0, url.ToLower().LastIndexOf("&wwtfull"));
                external = true;
            }

            if (url.ToLower().Contains("wwtfull=true"))
            {
                external = true;
            }

            url.Replace("&wwtfull=true", "");
            url.Replace("?wwtfull=true","");
            url.Replace("&wwtfull", "");
            url.Replace("?wwtfull","");

            if (external)
            {
                try
                {
                    System.Diagnostics.Process.Start(url);
                }
                catch
                {
                }
            }
            else
            {
                WebWindow ww = new WebWindow();

                if (url.ToLower().Contains("worldwidetelescope.org"))
                {
                    ww.Width = 1250;
                }
                ww.Url = url;
                ww.Show();
                ww.allowFullBrowser = true;

            }
        }