Ejemplo n.º 1
0
        // GetKeywords()

        private void GetKeywordsBtn_Click(object sender, EventArgs e)
        {
            ClearAll();

            if (!Globals.catalog.IsOpen)
            {
                MessageBox.Show("Open a catalog first!");
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                //Setup screen
                splitContainer1.Panel1Collapsed = false;
                resultsPanel.SetupView(Panel_HelpTopicResults.HelpTopicResultsView.AllTopics);

                _helpKeywords = Globals.catalogRead.GetKeywords(Globals.catalog, true);  //true = caching. This really speeds up loading
                keywordsListView.VirtualListSize = _helpKeywords.Count;
                UpdateStatus();
            }
            catch
            {
                ClearAll();
                MessageBox.Show("Exception while calling catalogRead.GetKeywords()");
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        public Page_Topics()
        {
            InitializeComponent();
            self = this;

            //Panel for to show HelpTopic results
            resultsPanel = new Panel_HelpTopicResults(this, DockStyle.Fill);
            resultsPanel.SetupView(Panel_HelpTopicResults.HelpTopicResultsView.HelpTopic);

            //Toc Select panel
            tocPanel = new Panel_Toc(this, TopicFromIdCbo, Globals.catalog);

            //Persistence: Load settings
            using (UserData userData = new UserData(Globals.DataRegKey))
            {
                TopicFromIdCbo.Text = userData.ReadStr("Keyword.TopicFromIdCbo", "");
                TopicFromF1TextBox.Text = userData.ReadStr("Keyword.TopicFromF1TextBox", "");
            }

            // Super Tips
            new SuperTip(tipFileStreamOnly, "File Stream Only",
                "The raw unrendered topic source from the .mshc help file.",
                "Expect Script errors. Being unrendered it won't be WebBrowser friendly.");

            new SuperTip(TopicFromIdTip, "Get Topic for Topic ID",
                "ITopic = ICatalogRead.GetIndexedTopicDetails()",
                "IStream = ICatalogRead.GetIndexedTopic()",
                "Enter a topic ID for the required topic.",
                "If successful the call returns a topic file ITopic object or topic IStream.",
                "Note that the topic object also contains a convenient method to Fetch the stream.");
            new SuperTip(TopicFromF1Tip, "Get Topic for F1 Keyword(s)",
                "ITopic = ICatalogRead.GetTopicDetailsForF1Keyword()",
                "IStream = ICatalogRead.GetTopicForF1Keyword()",
                "Enter a prioritized list of F1 keywords separated by '|' chars (arbitary).",
                "If successful the call returns a ITopic Object or a topic IStream.",
                "Note that the topic object also contains a convenient method to Fetch the stream.");
            new SuperTip(GetAssetTip, "IStream catalogRead.GetLinkedAsset(catalog, packageName, path, locale)",
                "Example:    ",
                "   Stream stream = catalogRead.GetLinkedAsset(catalog, ",
                "        \"Visual_Studio_21800791_VS_100_en-us_6.mshc\",",
                "        \"\\R583.htm\", \"en-US\");",
                "For the purpose of this quick demo we get an asset path from ",
                "a Topic obj retieved using the specified topic ID.",
                "However this can be used to retrieve any asset file (image, JS, CSS etc).");
        }
Ejemplo n.º 3
0
        public Page_Topics()
        {
            InitializeComponent();
            self = this;

            //Panel for to show HelpTopic results
            resultsPanel = new Panel_HelpTopicResults(this, DockStyle.Fill);
            resultsPanel.SetupView(Panel_HelpTopicResults.HelpTopicResultsView.HelpTopic);

            //Toc Select panel
            tocPanel = new Panel_Toc(this, TopicFromIdCbo, Globals.catalog);

            //Persistence: Load settings
            using (UserData userData = new UserData(Globals.DataRegKey))
            {
                TopicFromIdCbo.Text     = userData.ReadStr("Keyword.TopicFromIdCbo", "");
                TopicFromF1TextBox.Text = userData.ReadStr("Keyword.TopicFromF1TextBox", "");
            }

            // Super Tips
            new SuperTip(tipFileStreamOnly, "File Stream Only",
                         "The raw unrendered topic source from the .mshc help file.",
                         "Expect Script errors. Being unrendered it won't be WebBrowser friendly.");

            new SuperTip(TopicFromIdTip, "Get Topic for Topic ID",
                         "ITopic = ICatalogRead.GetIndexedTopicDetails()",
                         "IStream = ICatalogRead.GetIndexedTopic()",
                         "Enter a topic ID for the required topic.",
                         "If successful the call returns a topic file ITopic object or topic IStream.",
                         "Note that the topic object also contains a convenient method to Fetch the stream.");
            new SuperTip(TopicFromF1Tip, "Get Topic for F1 Keyword(s)",
                         "ITopic = ICatalogRead.GetTopicDetailsForF1Keyword()",
                         "IStream = ICatalogRead.GetTopicForF1Keyword()",
                         "Enter a prioritized list of F1 keywords separated by '|' chars (arbitary).",
                         "If successful the call returns a ITopic Object or a topic IStream.",
                         "Note that the topic object also contains a convenient method to Fetch the stream.");
            new SuperTip(GetAssetTip, "IStream catalogRead.GetLinkedAsset(catalog, packageName, path, locale)",
                         "Example:    ",
                         "   Stream stream = catalogRead.GetLinkedAsset(catalog, ",
                         "        \"Visual_Studio_21800791_VS_100_en-us_6.mshc\",",
                         "        \"\\R583.htm\", \"en-US\");",
                         "For the purpose of this quick demo we get an asset path from ",
                         "a Topic obj retieved using the specified topic ID.",
                         "However this can be used to retrieve any asset file (image, JS, CSS etc).");
        }
Ejemplo n.º 4
0
        // Get Topic by ID

        private void DoGetTopicFromId(Boolean getDetails)  //false to return just the file IStream
        {
            if (!Globals.catalog.IsOpen)
            {
                MessageBox.Show("Open a catalog first!");
                return;
            }

            ClearAll();

            IHelpFilter filter = null;  // no filtering

            String topicID = TopicFromIdCbo.Text.Trim();

            if (String.IsNullOrEmpty(topicID))
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (getDetails)  //Returns detail object
                {
                    resultsPanel.SetupView(Panel_HelpTopicResults.HelpTopicResultsView.HelpTopic);

                    ITopic helpTopic = Globals.catalogRead.GetIndexedTopicDetails(Globals.catalog, topicID, filter);

                    if (helpTopic == null)
                    {
                        MessageBox.Show("No results found! Returned null.");
                    }
                    else  //display result
                    {
                        resultsPanel.DisplayHelpTopic(helpTopic);
                    }
                }
                else //Returns just the stream
                {
                    resultsPanel.SetupView(Panel_HelpTopicResults.HelpTopicResultsView.RawContent);

                    //Get Stream only
                    Stream stream = (Stream)Globals.catalogRead.GetIndexedTopic(Globals.catalog, topicID, filter);
                    if (stream == null)
                    {
                        MessageBox.Show("No results found! Returned null.");
                    }
                    else
                    {
                        resultsPanel.ViewStream(stream);
                        stream.Close();
                    }
                }
            }
            catch
            {
                MessageBox.Show("No results. Exception while calling catalogRead.GetIndexedTopic...()");
            }
            finally
            {
                Cursor.Current = Cursors.Default;

                //Persistence: Save settings
                using (UserData userData = new UserData(Globals.DataRegKey))
                {
                    userData.WriteStr("Keyword.TopicFromIdCbo", TopicFromIdCbo.Text);
                }
            }
        }