Esempio n. 1
0
        public override void DocumentCompleted(HtmlViewPane pane, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e)
        {
            if (pane == null)
            {
                throw new ArgumentNullException("pane");
            }

            ExtendedWebBrowser browser = pane.WebBrowser;

            if (browser == null || browser.Document == null)
            {
                return;
            }
            HtmlElementCollection divs = browser.Document.GetElementsByTagName("div");

            foreach (HtmlElement div in divs)
            {
                if (!string.IsNullOrEmpty(div.Id))
                {
                    if (div.Id.Equals("LeftNav", StringComparison.InvariantCultureIgnoreCase) ||
                        div.Id.Equals("TocResize", StringComparison.InvariantCultureIgnoreCase))
                    {
                        div.Style = "visibility:hidden;display:none;width:0px";
                    }
                }
            }
        }
Esempio n. 2
0
        public override void InterceptNavigate(HtmlViewPane pane, WebBrowserNavigatingEventArgs e)
        {
            e.Cancel = true;
            if (_page == null)
            {
                _page = new StartPageCodePage();
            }
            string host = e.Url.Host;

            if (host.Equals(OPENPROJECT_HOST, StringComparison.CurrentCultureIgnoreCase))
            {
                string projectFile = e.Url.LocalPath.TrimStart('/');
                if (String.IsNullOrEmpty(projectFile) == false)
                {
                    FileInfo fileInfo = new FileInfo(projectFile);
                    if (fileInfo.Exists)
                    {
                        _projectService.OpenProject(fileInfo.FullName);
                    }
                }
            }
            else
            {
                pane.WebBrowser.DocumentText = _page.Render(host);
            }
        }
        public override void InterceptNavigate(HtmlViewPane pane, WebBrowserNavigatingEventArgs e)
        {
            e.Cancel = true;
            if (_page == null)
            {
                //page = new ICSharpCodePage();
                _page = new StartPageCodePage();
                // page.Title = ICSharpCode.Core.StringParser.Parse("${res:StartPage.StartPageContentName}");
            }
            string host = e.Url.Host;

            if (host.Equals(OPENPROJECT_HOST, StringComparison.CurrentCultureIgnoreCase))
            {
                //   string projectFile = page.projectFiles[int.Parse(e.Url.LocalPath.Trim('/'))];
                //   FileUtility.ObservedLoad(new NamedFileOperationDelegate(ProjectService.LoadSolution), projectFile);

                string projectFile = e.Url.LocalPath.TrimStart('/');
                if (String.IsNullOrEmpty(projectFile) == false)
                {
                    //FileInfo最主要的作用是包装这个路径,因为从URL拿下来的路径会用 / ,而windows文件路径应该用 \
                    //这个不影响打开文件,但是会使History多记录一个项目打开历史,只是一个 / ,一个\
                    FileInfo fileInfo = new FileInfo(projectFile);
                    if (fileInfo.Exists)
                    {
                        //_projectService.OpenProject(fileInfo.FullName);
                    }
                }
            }
            else
            {
                pane.WebBrowser.DocumentText = _page.Render(host);
            }
        }
Esempio n. 4
0
//		[PermissionSet(SecurityAction.LinkDemand, Name="Execution")]
        public override void DocumentCompleted(HtmlViewPane pane, WebBrowserDocumentCompletedEventArgs e)
        {
            if (pane == null)
            {
                throw new ArgumentNullException("pane");
            }
            ShowHelpBrowser.HighlightDocument(pane);
        }
Esempio n. 5
0
 public override void GoHome(HtmlViewPane pane)
 {
     if (pane == null)
     {
         throw new ArgumentNullException("pane");
     }
     DisplayHelp.Catalog();
 }
Esempio n. 6
0
 public override void GoSearch(HtmlViewPane pane)
 {
     if (pane == null)
     {
         throw new ArgumentNullException("pane");
     }
     pane.Navigate(new Uri(string.Format(@"http://social.msdn.microsoft.com/Search/{0}", CultureInfo.CurrentCulture.Name.ToLower())));
 }
Esempio n. 7
0
 public override void GoSearch(HtmlViewPane pane)
 {
     if (pane == null)
     {
         throw new ArgumentNullException("pane");
     }
     pane.Navigate(new Uri(HtmlHelp2Environment.SearchPage));
 }
        public override void InterceptNavigate(HtmlViewPane pane, WebBrowserNavigatingEventArgs e)
        {
            e.Cancel = true;
            if (_page == null)
            {
                _page = new ProjectCodePage();
            }
            string host = e.Url.Host;

            pane.WebBrowser.DocumentText = _page.Render(host);
        }
Esempio n. 9
0
 public static void HighlightDocument(HtmlViewPane htmlViewPane)
 {
     if (htmlViewPane == null)
     {
         throw new ArgumentNullException("htmlViewPane");
     }
     if (hiliteMatches && lastTopic != null)
     {
         lastTopic.HighlightDocument(htmlViewPane.WebBrowser.Document.DomDocument);
     }
 }
        public override void DocumentCompleted(HtmlViewPane pane, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlElement btn = null;

            btn = pane.WebBrowser.Document.GetElementById("btnOpenProject");
            if (btn != null)
            {
            }
            btn = pane.WebBrowser.Document.GetElementById("btnNewProject");
            if (btn != null)
            {
            }
            pane.WebBrowser.Navigating += pane_WebBrowser_Navigating;
            pane.WebBrowser.Navigated  += pane_WebBrowser_Navigated;
        }
Esempio n. 11
0
        public override void DocumentCompleted(HtmlViewPane pane, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlElement btn = null;

            btn = pane.WebBrowser.Document.GetElementById("btnOpenProject");
            if (btn != null)
            {
                btn.Click += delegate { _projectService.OpenProject(); };
            }
            btn = pane.WebBrowser.Document.GetElementById("btnNewProject");
            if (btn != null)
            {
                btn.Click += delegate { _projectService.NewProject(); };
            }
            pane.WebBrowser.Navigating += pane_WebBrowser_Navigating;
            pane.WebBrowser.Navigated  += pane_WebBrowser_Navigated;
        }
Esempio n. 12
0
//		[PermissionSet(SecurityAction.LinkDemand, Name="Execution")]
        public override void InterceptNavigate(HtmlViewPane pane, WebBrowserNavigatingEventArgs e)
        {
            if (pane == null)
            {
                throw new ArgumentNullException("pane");
            }
            if (scriptObject == null)
            {
                scriptObject = new JScriptExternal();
                LoadHelpState();
            }
            pane.WebBrowser.ObjectForScripting = scriptObject;
            // add event (max. 1 one time)
            pane.WebBrowser.Disposed -= SaveHelpState;
            pane.WebBrowser.Disposed += SaveHelpState;
            base.InterceptNavigate(pane, e);
        }
Esempio n. 13
0
        public override void DocumentCompleted(HtmlViewPane pane, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlElement btn;

            btn = pane.WebBrowser.Document.GetElementById("opencombine");
            if (btn != null)
            {
                LoggingService.Debug("Attached event handler to opencombine button");
                btn.Click += delegate { new ICSharpCode.SharpDevelop.Project.Commands.LoadSolution().Run(); };
            }
            btn = pane.WebBrowser.Document.GetElementById("newcombine");
            if (btn != null)
            {
                btn.Click += delegate { new ICSharpCode.SharpDevelop.Project.Commands.CreateNewSolution().Run(); };
            }

            pane.WebBrowser.Navigating += pane_WebBrowser_Navigating;
            pane.WebBrowser.Navigated  += pane_WebBrowser_Navigated;
        }
Esempio n. 14
0
        public override void InterceptNavigate(HtmlViewPane pane, WebBrowserNavigatingEventArgs e)
        {
            e.Cancel = true;
            if (page == null)
            {
                page       = new ICSharpCodePage();
                page.Title = ICSharpCode.Core.StringParser.Parse("${res:StartPage.StartPageContentName}");
            }
            string host = e.Url.Host;

            if (host == "project")
            {
                string projectFile = page.projectFiles[int.Parse(e.Url.LocalPath.Trim('/'))];
                FileUtility.ObservedLoad(new NamedFileOperationDelegate(ProjectService.LoadSolution), projectFile);
            }
            else
            {
                pane.WebBrowser.DocumentText = page.Render(host);
            }
        }
        public override void DocumentCompleted(HtmlViewPane pane, WebBrowserDocumentCompletedEventArgs e)
        {
            //HtmlElement btn;
            HtmlElement btn = null;

            btn = pane.WebBrowser.Document.GetElementById("btnOpenProject");
            if (btn != null)
            {
                //为按钮挂接事件
                //LoggingService.Debug("Attached event handler to opencombine button");
                btn.Click += delegate { MessageBox.Show("调用 C# 中的打开项目方法。"); };
            }
            btn = pane.WebBrowser.Document.GetElementById("btnNewProject");
            if (btn != null)
            {
                btn.Click += delegate { MessageBox.Show("调用 C# 中的新建项目方法。"); };
            }

            pane.WebBrowser.Navigating += pane_WebBrowser_Navigating;
            pane.WebBrowser.Navigated  += pane_WebBrowser_Navigated;
        }
Esempio n. 16
0
 public override void GoHome(HtmlViewPane pane)
 {
     pane.Navigate(STARTPAGE_CONST.URL);
 }
Esempio n. 17
0
 public override void GoHome(HtmlViewPane pane)
 {
     pane.Navigate(STARTPAGE_URI);
 }
Esempio n. 18
0
 public override void GoHome(HtmlViewPane pane)
 {
     pane.Navigate("startpage://start/");
 }