예제 #1
0
        /// <summary>
        /// Populate the view given the specified text.
        /// </summary>
        /// <param name="contents"></param>
        /// <param name="editingEnabled"></param>
        /// <returns></returns>
        private void PopulateView(string contents)
        {
            if (browser == null)
            {
                if (ProcessUtilities.CurrentOS.IsWindows)
                {
                    browser = CreateIEBrowser(vbox2);

                    /// UGH! Once the browser control gets keyboard focus, it doesn't relinquish it to
                    /// other controls. It's actually a COM object, I guess, and running
                    /// with a different message loop, and probably in a different thread.
                    ///
                    /// Well, this hack works, more or less.
                    if (vbox2.Toplevel is Window)
                    {
                        (vbox2.Toplevel as Window).SetFocus += MainWindow_SetFocus;
                    }
                    frame1.Unrealized += Frame1_Unrealized;
                    if (this is MapView) // If we're only displaying a map, remove the unneeded scrollbar
                    {
                        (browser as TWWebBrowserIE).wb.ScrollBarsEnabled = false;
                    }
                }
                else if (ProcessUtilities.CurrentOS.IsMac)
                {
                    browser = CreateSafariBrowser(vbox2);
                }
                else
                {
                    browser = CreateWebKitBrowser(vbox2);
                }
            }
            browser.LoadHTML(contents);
            //browser.Navigate("http://blend-bp.nexus.csiro.au/wiki/index.php");
        }
예제 #2
0
        /// <summary>
        /// Populate the view given the specified text.
        /// </summary>
        /// <param name="contents"></param>
        /// <param name="editingEnabled"></param>
        /// <returns></returns>
        private void PopulateView(string contents, bool isURI = false)
        {
            if (browser == null)
            {
                if (ProcessUtilities.CurrentOS.IsWindows)
                {
                    browser = CreateIEBrowser(vbox2);

                    /// UGH! Once the browser control gets keyboard focus, it doesn't relinquish it to
                    /// other controls. It's actually a COM object, I guess, and running
                    /// with a different message loop, and probably in a different thread.
                    ///
                    /// Well, this hack works, more or less.
                    if (vbox2.Toplevel is Window)
                    {
                        (vbox2.Toplevel as Window).SetFocus += MainWindow_SetFocus;
                    }
                    frame1.Unrealized += Frame1_Unrealized;
                    if (this is MapView) // If we're only displaying a map, remove the unneeded scrollbar
                    {
                        (browser as TWWebBrowserIE).Browser.ScrollBarsEnabled = false;
                    }
                }
                else if (ProcessUtilities.CurrentOS.IsMac)
                {
                    browser = CreateSafariBrowser(vbox2);
                }
                else
                {
                    browser = CreateWebKitBrowser(vbox2);
                }
            }
            if (isURI)
            {
                browser.Navigate(contents);
            }
            else
            {
                browser.LoadHTML(contents);
            }

            if (browser is TWWebBrowserIE && (browser as TWWebBrowserIE).Browser != null)
            {
                TWWebBrowserIE ieBrowser = browser as TWWebBrowserIE;
                keyPressObject = ieBrowser.Browser.Document.ActiveElement;
                if (keyPressObject != null)
                {
                    (keyPressObject as HtmlElement).KeyPress += OnKeyPress;
                }
                ieBrowser.BackgroundColour = Utility.Colour.FromGtk(MainWidget.Style.Background(StateType.Normal));
                ieBrowser.ForegroundColour = Utility.Colour.FromGtk(MainWidget.Style.Foreground(StateType.Normal));
            }
            //browser.Navigate("http://blend-bp.nexus.csiro.au/wiki/index.php");
        }
예제 #3
0
파일: HTMLView.cs 프로젝트: pre078/ApsimX
 /// <summary>
 /// Populate the view given the specified text.
 /// </summary>
 /// <param name="contents"></param>
 /// <param name="editingEnabled"></param>
 /// <returns></returns>
 private bool PopulateView(string contents, bool editingEnabled)
 {
     if (browser == null)
     {
         if (Environment.OSVersion.Platform.ToString().StartsWith("Win"))
         {
             browser = new TWWebBrowserIE(vbox2);
         }
         else
         {
             browser = new TWWebBrowserWK(vbox2);
         }
     }
     browser.LoadHTML(contents);
     //browser.Navigate("http://blend-bp.nexus.csiro.au/wiki/index.php");
     return(editingEnabled);
 }