Exemplo n.º 1
0
        /// <summary>
        /// See <see cref="WizardForm.OnHelpButtonClicked"/>
        /// </summary>
        /// <param name="e"></param>
        protected override void OnHelpButtonClicked(CancelEventArgs e)
        {
            base.OnHelpButtonClicked(e);

            string helpRelativeLocation = this.wizardConfig.Help;

            Uri    baseLocation = null;
            string helpLocation = string.Empty;

            if (Uri.TryCreate(helpRelativeLocation, UriKind.RelativeOrAbsolute, out baseLocation))
            {
                if (baseLocation != null)
                {
                    if (baseLocation.IsAbsoluteUri)
                    {
                        if (baseLocation.IsFile)
                        {
                            helpLocation = baseLocation.LocalPath;
                        }
                        else
                        {
                            helpLocation = baseLocation.AbsoluteUri;
                        }
                    }
                    else
                    {
                        helpLocation = Path.Combine(basePath, helpRelativeLocation);
                    }
                }
            }
            else
            {
                throw new Exception(string.Format(Resources.WizardGatheringService_CannotGetHelpResource, helpLocation));
            }


            Microsoft.VisualStudio.VSHelp.Help help = (Microsoft.VisualStudio.VSHelp.Help)base.GetService(typeof(Microsoft.VisualStudio.VSHelp.Help));
            if (help != null)
            {
                try
                {
                    help.DisplayTopicFromURL(helpLocation);
                    Cursor.Current = Cursors.Arrow;
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format(Resources.WizardGatheringService_CannotGetHelpResource, helpLocation), ex);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Opens a given uri in the help window.
        /// </summary>
        /// <param name="uri">The URI.</param>
        private void ShowHelp(string uri)
        {
            string helpLocation = ParseUri(uri);

            Microsoft.VisualStudio.VSHelp.Help help = (Microsoft.VisualStudio.VSHelp.Help)base.GetService(typeof(Microsoft.VisualStudio.VSHelp.Help));
            if (help != null)
            {
                try
                {
                    help.DisplayTopicFromURL(helpLocation);
                    Cursor.Current = Cursors.Arrow;
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format(Resources.Navigator_CannotGetHelpResource, helpLocation), ex);
                }
            }
        }
Exemplo n.º 3
0
 void Wizard_HelpButtonClicked(object sender, CancelEventArgs e)
 {
     if (helpPage != "")
     {
         if (helpService == null)
         {
             helpService = (Microsoft.VisualStudio.VSHelp.Help)base.GetService(typeof(Microsoft.VisualStudio.VSHelp.Help));
         }
         if (helpService != null)
         {
             try
             {
                 helpService.DisplayTopicFromURL(helpPage);
             }
             catch (Exception)
             {
             }
         }
         e.Cancel = true;
     }
 }
Exemplo n.º 4
0
 private void wbPackageOverview_Navigating(object sender, WebBrowserNavigatingEventArgs e)
 {
     if (e.Url.ToString().ToLower().StartsWith("ms-help"))
     {
         Microsoft.VisualStudio.VSHelp.Help help = (Microsoft.VisualStudio.VSHelp.Help)base.GetService(typeof(Microsoft.VisualStudio.VSHelp.Help));
         if (help != null)
         {
             e.Cancel = true;
             try
             {
                 help.DisplayTopicFromURL(e.Url.ToString());
                 Cursor.Current = Cursors.Arrow;
             }
             catch (Exception ex)
             {
                 throw new Exception(string.Format(Resources.Navigator_CannotGetHelpResource, e.Url.ToString()), ex);
             }
         }
     }
     return;
 }
Exemplo n.º 5
0
        /// <devdoc>
        ///     Shows the given help topic.  This should contain a Url to the help
        ///     topic.  The topic will be displayed in
        ///     the environment's integrated help system.
        /// </devdoc>
        void IHelpService.ShowHelpFromUrl(string helpUrl)
        {
            Debug.Assert(provider != null, "Help service is in an invalid state.");
            Debug.Assert(helpUrl != null, "IHelpService.ShowHelpFromUrl called with a null string.");
            if ((provider == null) || (helpUrl == null))
            {
                return;
            }

            Microsoft.VisualStudio.VSHelp.Help help =
                (Microsoft.VisualStudio.VSHelp.Help)provider.GetService(typeof(Microsoft.VisualStudio.VSHelp.Help));

            if (help != null)
            {
                try {
                    // Don't throw in case of topic not found.
                    help.DisplayTopicFromURL(helpUrl);
                } catch (COMException) {
                    // IVsHelp can causes a ComException to be thrown if the help
                    // topic isn't found.
                }
            }
        }