Ejemplo n.º 1
0
        private void txtLinq_MouseClick(object sender, MouseEventArgs e)
        {
            //
            // Get the position inside the textbox based on the mouse cursor position.
            //
            int i = txtLinq.GetCharIndexFromPosition(e.Location);

            //
            // Error selected?
            //
            if (txtLinq.Cursor == Cursors.Hand && currentError != null)
            {
                try
                {
                    //
                    // Obtain reference to the Help2 object and display help associated with the SP**** error code.
                    //
                    EnvDTE.DTE dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.9.0");
                    Microsoft.VisualStudio.VSHelp80.Help2 help2 = (Microsoft.VisualStudio.VSHelp80.Help2)dte.GetObject("Help2");
                    help2.DisplayTopicFromKeyword(currentError.ErrorCode);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Couldn't load help information.\n\n" + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 2
0
 private void ShowHelp()
 {
     try
     {
         //
         // Obtain reference to the Help2 object and display help associated with the SP**** error code.
         //
         EnvDTE.DTE dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.9.0");
         Microsoft.VisualStudio.VSHelp80.Help2 help2 = (Microsoft.VisualStudio.VSHelp80.Help2)dte.GetObject("Help2");
         help2.DisplayTopicFromKeyword(currentError.ErrorCode);
     }
     catch (Exception ex)
     {
         MessageBoxOptions options = IsRightToLeft(this) ? MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading : 0;
         MessageBox.Show(Strings.CouldntLoadHelp + "\n\n" + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, options);
     }
 }