Beispiel #1
0
 //called at shutdown
 public void Cleanup()
 {
     //Persistence: Save settings
     using (UserData userData = new UserData(Globals.DataRegKey))
     {
         userData.WriteStr("Mshx.InputFilename", InputFilename);
         userData.WriteStr("Mshx.OutputDir", OutputDir);
         userData.WriteStr("Mshx.OutputName", OutputName);
         userData.WriteStr("Mshx.VendorName", VendorName);
         userData.WriteBool("Mshx.CombineMode", CombineMode);
     }
 }
Beispiel #2
0
        private void SearchBtnSearch()
        {
            _sQuery = SearchCbo.Text.Trim();
            if (String.IsNullOrEmpty(_sQuery))
                return;

            _searchOptions = SearchOptions.None;
            if (SearchTermHighlightCbx.Checked)
                _searchOptions = _searchOptions | SearchOptions.SearchTermHighlight;
            if (OrSearchOverrideCbx.Checked)
                _searchOptions = _searchOptions | SearchOptions.OrSearchOverride;

            //When searching with the Search Button we always start from Page 1
            _pageSize = (Int32)pageSizeEdit.Value;
            _pageNumber = 1;
            _totalAvailableHits = 0;
            resultsPanel.startListViewNumbering = 1;

            DoSearch();

            //Persistence: Save settings
            using (UserData userData = new UserData(Globals.DataRegKey))
            {
                userData.WriteStr("Search.Query", SearchCbo.Text);
                userData.WriteInt("Search.PageSize", (int)pageSizeEdit.Value);
            }
        }
Beispiel #3
0
        //false to return just the file IStream
        // Get Topic by ID
        private void DoGetTopicFromId(Boolean getDetails)
        {
            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);
                }
            }
        }
Beispiel #4
0
 private void TopicIdCbo_TextChanged(object sender, EventArgs e)
 {
     //Persistence: Save settings
     using (UserData userData = new UserData(Globals.DataRegKey))
     {
         userData.WriteStr("Toc.TopicIdCbo", TopicIdCbo.Text);
     }
 }
Beispiel #5
0
        //false to return just the file IStream
        // Get Topic by F1 Keyword
        private void DoGetTopicFromF1(Boolean getDetails)
        {
            if (!Globals.catalog.IsOpen)
            {
                MessageBox.Show("Open a catalog first!");
                return;
            }

            ClearAll();

            IHelpFilter filter = null;  // no filtering

            String keyword = TopicFromF1TextBox.Text.Trim();
            if (String.IsNullOrEmpty(keyword))
                return;

            String[] prioritizedF1Keywords = keyword.Split(new Char[] { '|' });   //arbitarily separate by ;
            for (int i = 0; i < prioritizedF1Keywords.Length; i++)
                prioritizedF1Keywords[i] = prioritizedF1Keywords[i].Trim();

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

                    //Do It
                    ITopic helpTopic = Globals.catalogRead.GetTopicDetailsForF1Keyword(Globals.catalog, prioritizedF1Keywords, 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);

                    //Do It
                    Stream stream = (Stream)Globals.catalogRead.GetTopicForF1Keyword(Globals.catalog, prioritizedF1Keywords, filter);

                    if (stream == null)
                        MessageBox.Show("No results found! Returned null.");
                    {
                        resultsPanel.ViewStream(stream);
                        stream.Close();
                    }
                }
            }
            catch
            {
                MessageBox.Show("No results. Exception while calling catalogRead.GetTopic...ForF1Keyword()");
            }
            finally
            {
                Cursor.Current = Cursors.Default;

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