Ejemplo n.º 1
0
        private void InitOtherPageTabs()
        {
            // Associate this application with the ms-xhelp:/// protocol
            msxhelpProtocol = new MsxhelpProtocol();

            // About page
            InitAboutPageTab();

            //Store Page
            Page_Store storePage = new Page_Store();
            storePage.Parent = tabPagContentStore;
            storePage.Dock = DockStyle.Fill;

            //Create MSHX Page
            Page_CreateMSHX mshxPage = new Page_CreateMSHX();
            mshxPage.Parent = tabPageMshx;
            mshxPage.Dock = DockStyle.Fill;

            //Event Log Page
            eventLogPage = new Page_EventLog(tabPageEventLog);
            eventLogPage.Parent = tabPageEventLog;
            eventLogPage.Dock = DockStyle.Fill;

            //Other
            new SuperTip(imageRenderWithVS, "Render with VS",
                "Topics extracted from a catalog's .mshc help file are not yet rendered for viewing in the browser.",
                "EG. Links need to be expanded to use the ms-xhelp:/// protocol and point to the correct location in the catalog",
                "By default we provide a pluggle protocol and code that renders the HTML.",
                "Check this box to render using the VS rendering code in Microsoft.VisualStudio.Help.dll");
        }
Ejemplo n.º 2
0
        public void Start(string szURL, IInternetProtocolSink sink, IInternetBindInfo pOIBindInfo, uint grfPI, uint dwReserved)
        {
            //Debug.WriteLine("xxHelpAsyncPluggableProtocolHandler.Start(" + szURL + ")");

            String mimeType = "text/html";

            // type = "text" / "image" / "audio" / "video" / "application" / extension-token
            //type/subtype eg. "text/html", "image/png", "image/gif", "video/mpeg", "text/css", and "audio/basic"

            if (MsxhelpProtocol.Catalog == null || !MsxhelpProtocol.Catalog.IsOpen)
            {
                _stream = null;
            }
            else
            {
                try
                {
                    if (_customRenderer == null)
                    {
                        _customRenderer = CustomRenderer.Create();
                    }

                    String  topicID;
                    Boolean isTopicUrl = _customRenderer.IsTopicUrl(szURL, out topicID);

                    // -----------------------------------------------------------------------
                    // debug - Host wants to see raw HTML from .mshc

                    if (MsxhelpProtocol.RawCodeHandler != null)
                    {
                        try
                        {
                            if (isTopicUrl && String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText)) // Topic with no text overload
                            {
                                _stream = _customRenderer.UrlToStream(szURL, false);               // false = No Render.
                                if (this._stream != null)
                                {
                                    _stream.Position = 0;
                                    StreamReader reader = new StreamReader(_stream);
                                    String       text   = reader.ReadToEnd();
                                    MsxhelpProtocol.RawCodeHandler(text);    //send text to main form
                                    this._stream.Close();
                                    this._stream = null;
                                }
                            }
                        }
                        catch
                        {
                            //suck it up.. the next bit is the important part
                        }
                    }

                    // -----------------------------------------------------------------------
                    // render - Web browser wants rendered code

//                    if (MsxhelpProtocol.RenderUsingVS)  // Requires VS 11 DLL (Microsoft.VisualStudio.Help.DLL)
//                    {
//                        if (_vsRenderer == null)                      //will crash if VS not installed
//                            _vsRenderer = new TopicRenderer();

                    //                       _stream = (Stream)_vsRenderer.ProcessLink(szURL, (ICatalog)MsxhelpProtocol.Catalog, null/*_renderParameters*/);
//                    }
//                    else  // basic render code supplied with this SDK -- Good for Win 8 where VS 11 not installed
                    {
                        _stream          = _customRenderer.UrlToStream(szURL);
                        _stream.Position = 0;
                    }
                }
                catch
                {
                    _stream = null;
                }
            }

            if (_stream != null)
            {
                //Set Mime type
                uint BINDSTATUS_MIMETYPEAVAILABLE = 13;
                if (mimeType != "")
                {
                    sink.ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, mimeType);
                }

                sink.ReportData(BSCF.LASTDATANOTIFICATION | BSCF.DATAFULLYAVAILABLE, (uint)_stream.Length, (uint)_stream.Length);
                sink.ReportResult((uint)HRESULT.S_OK, 200, null);
            }
            else
            {
                sink.ReportResult((uint)HRESULT.INET_E_OBJECT_NOT_FOUND, 404, "Cannot find the goods");
            }
        }
Ejemplo n.º 3
0
        public Form1(string[] args)
        {
            InitializeComponent();

            //Theme the listViews
            Native.SetWindowTheme(this.indexListView.Handle, "explorer");
            Native.SetWindowTheme(this.resultsListView.Handle, "explorer");
            Native.SetWindowTheme(this.searchListView.Handle, "explorer");

            formTitle = this.Text;

            //
            // Help API:  Access a Catalog and it's Data
            //
            _catalog = new Catalog();
            _catalogRead = new CatalogRead();

            //
            // TOC Tab
            //
            tocPanel = new Panel_Toc(tabPageTOC);  //parent the TOC panel
            tocPanel.Dock = DockStyle.Fill;
            tocPanel.AddSelectCallback(TocNodeSelectionEvent);

            //Fill Catalog List (menu) with registered VS 11 catalogs
            FillCatalogList();

            // Associate this application with the ms-xhelp:/// protocol
            msxhelpProtocol = new MsxhelpProtocol();
            msxhelpProtocol.AddRawCodeCallback(RawCodeChangeEvent);

            if (args.Length==1)
            {
                initialQuery = args[0];
            }
        }