Beispiel #1
0
        private void ShowSelectedItemEntry(string indexTerm, int indexSlot)
        {
            if (HtmlHelp2IndexResultsPad.Current == null)
            {
                ShowIndexResultsMenuCommand cmd = new ShowIndexResultsMenuCommand();
                cmd.Run();
                if (HtmlHelp2IndexResultsPad.Current == null)
                {
                    return;
                }
            }

            try
            {
                IHxTopicList matchingTopics = indexControl.IndexData.GetTopicsFromSlot(indexSlot);

                try
                {
                    HtmlHelp2IndexResultsPad.Current.CleanUp();
                    HtmlHelp2IndexResultsPad.Current.IndexResultsListView.BeginUpdate();

                    foreach (IHxTopic topic in matchingTopics)
                    {
                        ListViewItem lvi = new ListViewItem();
                        lvi.Text =
                            topic.get_Title(HxTopicGetTitleType.HxTopicGetRLTitle,
                                            HxTopicGetTitleDefVal.HxTopicGetTitleFileName);
                        lvi.Tag = topic;
                        lvi.SubItems.Add(topic.Location);
                        HtmlHelp2IndexResultsPad.Current.IndexResultsListView.Items.Add(lvi);
                    }
                }
                finally
                {
                    HtmlHelp2IndexResultsPad.Current.IndexResultsListView.EndUpdate();
                    HtmlHelp2IndexResultsPad.Current.SortLV(0);
                    HtmlHelp2IndexResultsPad.Current.SetStatusMessage(indexTerm);
                }

                switch (matchingTopics.Count)
                {
                case 0:
                    break;

                case 1:
                    IHxTopic topic = (IHxTopic)matchingTopics.ItemAt(1);
                    if (topic != null)
                    {
                        WebBrowserHelper.OpenHelpView(topic);
                    }
                    break;

                default:
                    HtmlHelp2IndexResultsPad.Current.BringPadToFront();
                    break;
                }
            }
            catch (System.Runtime.InteropServices.COMException cEx)
            {
                LoggingService.Error("Help 2.0: cannot get matching index entries; " + cEx.ToString());
            }
        }