private static void InitializeNamespace() { LoadHelp2Config(); if (string.IsNullOrEmpty(defaultNamespaceName)) { return; } session = null; HtmlHelp2Dialog initDialog = new HtmlHelp2Dialog(); try { initDialog.Text = StringParser.Parse("${res:AddIns.HtmlHelp2.HelpUpdateCaption}"); initDialog.ActionLabel = StringParser.Parse("${res:AddIns.HtmlHelp2.HelpUpdateInProgress}"); initDialog.Show(); Application.DoEvents(); currentSelectedFilterQuery = string.Empty; currentSelectedFilterName = string.Empty; session = new HxSession(); session.Initialize(String.Format(CultureInfo.InvariantCulture, "ms-help://{0}", defaultNamespaceName), 0); namespaceFilters = session.GetFilterList(); ReloadDefaultPages(); ReloadFTSSystem(); ReloadDynamicHelpSystem(); LoggingService.Info("Help 2.0: Service sucessfully loaded"); } catch (System.Runtime.InteropServices.COMException cEx) { LoggingService.Error("Help 2.0: Cannot not initialize service; " + cEx.ToString()); session = null; } finally { initDialog.Dispose(); } }
private void PerformFts(string searchWord, bool useDynamicHelp) { if (!HtmlHelp2Environment.SessionIsInitialized || string.IsNullOrEmpty(searchWord) || searchIsBusy) { return; } HtmlHelp2SearchResultsView searchResults = HtmlHelp2SearchResultsView.Instance; HtmlHelp2Dialog searchDialog = new HtmlHelp2Dialog(); try { searchIsBusy = true; IHxTopicList matchingTopics = null; HxQuery_Options searchFlags = HxQuery_Options.HxQuery_No_Option; searchFlags |= (titlesOnly.Checked)?HxQuery_Options.HxQuery_FullTextSearch_Title_Only:HxQuery_Options.HxQuery_No_Option; searchFlags |= (enableStemming.Checked)?HxQuery_Options.HxQuery_FullTextSearch_Enable_Stemming:HxQuery_Options.HxQuery_No_Option; searchFlags |= (reuseMatches.Checked)?HxQuery_Options.HxQuery_FullTextSearch_SearchPrevious:HxQuery_Options.HxQuery_No_Option; searchDialog.Text = StringParser.Parse("${res:AddIns.HtmlHelp2.HelpSearchCaption}"); searchDialog.ActionLabel = StringParser.Parse("${res:AddIns.HtmlHelp2.HelpSearchInProgress}", new string[,] {{"0", searchWord}}); searchDialog.Show(); Application.DoEvents(); Cursor.Current = Cursors.WaitCursor; if (useDynamicHelp) matchingTopics = HtmlHelp2Environment.GetMatchingTopicsForDynamicHelp(searchWord); else matchingTopics = HtmlHelp2Environment.Fts.Query(searchWord, searchFlags); Cursor.Current = Cursors.Default; try { searchResults.CleanUp(); searchResults.SearchResultsListView.BeginUpdate(); foreach (IHxTopic topic in matchingTopics) { if (useCurrentLang.Checked && !useDynamicHelp && !SharpDevLanguage.CheckTopicLanguage(topic)) continue; ListViewItem lvi = new ListViewItem(); lvi.Text = topic.get_Title(HxTopicGetTitleType.HxTopicGetRLTitle, HxTopicGetTitleDefVal.HxTopicGetTitleFileName); lvi.Tag = topic; lvi.SubItems.Add(topic.Location); lvi.SubItems.Add(topic.Rank.ToString(CultureInfo.CurrentCulture)); searchResults.SearchResultsListView.Items.Add(lvi); } reuseMatches.Enabled = true; } finally { searchResults.SearchResultsListView.EndUpdate(); searchResults.SetStatusMessage(searchTerm.Text); SearchAndReplace.SearchResultPanel.Instance.ShowSearchResults( new SearchAndReplace.SearchResult(searchTerm.Text, searchResults) ); searchIsBusy = false; } } catch (System.Runtime.InteropServices.COMException ex) { LoggingService.Error("Help 2.0: cannot get matching search word; " + ex.ToString()); foreach (Control control in this.mainPanel.Controls) { control.Enabled = false; } } finally { searchDialog.Dispose(); } }
private static void InitializeNamespace() { LoadHelp2Config(); if (string.IsNullOrEmpty(defaultNamespaceName)) { return; } session = null; HtmlHelp2Dialog initDialog = new HtmlHelp2Dialog(); try { initDialog.Text = StringParser.Parse("${res:AddIns.HtmlHelp2.HelpUpdateCaption}"); initDialog.ActionLabel = StringParser.Parse("${res:AddIns.HtmlHelp2.HelpUpdateInProgress}"); initDialog.Show(); Application.DoEvents(); currentSelectedFilterQuery = string.Empty; currentSelectedFilterName = string.Empty; session = new HxSession(); session.Initialize(String.Format(CultureInfo.InvariantCulture, "ms-help://{0}", defaultNamespaceName), 0); namespaceFilters = session.GetFilterList(); ReloadDefaultPages(); ReloadFTSSystem(); ReloadDynamicHelpSystem(); LoggingService.Info("Help 2.0: Service sucessfully loaded"); } catch (System.Runtime.InteropServices.COMException cEx) { LoggingService.Error("Help 2.0: Cannot not initialize service; " + cEx.ToString()); session = null; } finally { initDialog.Dispose(); } }