public static IHxIndex GetIndex(string filterQuery)
        {
            IHxIndex defaultIndex =
                (IHxIndex)session.GetNavigationInterface("!DefaultKeywordIndex", filterQuery, ref IndexGuid);

            return(defaultIndex);
        }
        private static string GetDefaultPage(string pageName, string alternatePageName, string defaultValue)
        {
            if (string.IsNullOrEmpty(pageName) && string.IsNullOrEmpty(alternatePageName))
            {
                throw new ArgumentNullException("pageName & alternatePageName");
            }
            try
            {
                string result = string.Empty;

                IHxIndex namedUrlIndex =
                    (IHxIndex)session.GetNavigationInterface("!DefaultNamedUrlIndex", "", ref IndexGuid);
                IHxTopicList topics = namedUrlIndex.GetTopicsFromString(pageName, 0);

                if (topics.Count == 0 && !string.IsNullOrEmpty(alternatePageName))
                {
                    topics = namedUrlIndex.GetTopicsFromString(alternatePageName, 0);
                }

                if (topics.Count > 0)
                {
                    result = topics.ItemAt(1).URL;
                }
                if (string.IsNullOrEmpty(result))
                {
                    result = defaultValue;
                }

                return(result);
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                return(defaultValue);
            }
        }
 private static void ReloadDynamicHelpSystem()
 {
     try
     {
         dynamicHelp = (IHxIndex)session.GetNavigationInterface
                           ("!DefaultContextWindowIndex", currentSelectedFilterQuery, ref IndexGuid);
     }
     catch (System.Runtime.InteropServices.COMException)
     {
         dynamicHelp = null;
     }
 }
Example #4
0
        /// <summary>
        /// Starts the command
        /// </summary>
        public override void Run()
        {
            ICSharpCode.SharpDevelop.Gui.TaskView view = (ICSharpCode.SharpDevelop.Gui.TaskView)Owner;

            // Search all selected tasks
            foreach (Task t in new List <Task>(view.SelectedTasks))
            {
                if (t.BuildError == null)
                {
                    continue;
                }

                string code = t.BuildError.ErrorCode;

                if (string.IsNullOrEmpty(code))
                {
                    return;
                }

                // Get help content
                MSHelpServices.IHxTopic topic;

                // If HtmlHelp2 AddIn is initialised correctly we can start!
                if (HtmlHelp2.Environment.HtmlHelp2Environment.SessionIsInitialized)
                {
                    // Get the topic
                    IHxIndex index = HtmlHelp2.Environment.HtmlHelp2Environment.GetIndex("");
                    if (index == null)
                    {
                        MessageService.ShowErrorFormatted("No help available for {0}!", code);
                        return;
                    }
                    int indexSlot = index.GetSlotFromString(code);
                    if (indexSlot <= 0)
                    {
                        MessageService.ShowErrorFormatted("No help available for {0}!", code);
                        return;
                    }
                    IHxTopicList list = index.GetTopicsFromSlot(indexSlot);
                    if (list == null)
                    {
                        MessageService.ShowErrorFormatted("No help available for {0}!", code);
                        return;
                    }
                    try {
                        topic = list.ItemAt(1);
                    } catch (ArgumentException) {
                        topic = null;
                    }
                    if (topic == null)
                    {
                        MessageService.ShowErrorFormatted("No help available for {0}!", code);
                        return;
                    }
                    string topicTitle = topic.get_Title(HxTopicGetTitleType.HxTopicGetTOCTitle, HxTopicGetTitleDefVal.HxTopicGetTitleFileName);
                    if (topicTitle == null || !topicTitle.Contains(code))
                    {
                        MessageService.ShowErrorFormatted("No help available for {0}!", code);
                        return;
                    }
                }
                else                     // Otherwise we have to show an Error message ...
                {
                    LoggingService.Error("Couldn't initialize help database");
                    return;
                }

                // Show Browser window
                HtmlHelp2.ShowHelpBrowser.OpenHelpView(topic);
            }
        }
		private static void ReloadDynamicHelpSystem()
		{
			try
			{
				dynamicHelp = (IHxIndex)session.GetNavigationInterface
					("!DefaultContextWindowIndex", currentSelectedFilterQuery, ref IndexGuid);
			}
			catch (System.Runtime.InteropServices.COMException)
			{
				dynamicHelp = null;
			}
		}