Cromon

Connect.cs

Oct 16th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.52 KB | None | 0 0
  1.             if(connectMode == ext_ConnectMode.ext_cm_UISetup)
  2.             {
  3.                 if (mIsCmdLoaded == false)
  4.                 {
  5.                     object[] contextGUIDS = new object[] { };
  6.                     Commands2 commands = (Commands2)_applicationObject.Commands;
  7.  
  8.                     try
  9.                     {
  10.                         CommandBar toolsControl = (CommandBar)((CommandBars)_applicationObject.CommandBars)["Code Window"];
  11.                         CommandBar toolsBar = (CommandBar)((CommandBars)_applicationObject.CommandBars)["Tools"];
  12.                         var pasteMenu = (CommandBarPopup)toolsBar.Controls.Add(MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, 1, true);
  13.                         pasteMenu.CommandBar.Name = "VxPasteBin";
  14.                         pasteMenu.Caption = "VxPasteBin";
  15.  
  16.                         Command cmd = null;
  17.                         Command cmd2 = null;
  18.                         try
  19.                         {
  20.                             cmd = commands.Item(_addInInstance.ProgID + ".VxPasteBinUpload");
  21.                             cmd2 = commands.Item(_addInInstance.ProgID + ".VxPasteBinSettings");
  22.                         }
  23.                         catch (Exception)
  24.                         {
  25.                         }
  26.  
  27.                         if (cmd == null)
  28.                             cmd = commands.AddNamedCommand2(_addInInstance, "VxPasteBinUpload", "Upload to Pastebin", "Upload the code to pastebin!", true, 59, ref contextGUIDS, (int)(vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported), (int)(vsCommandStyle.vsCommandStylePictAndText) , vsCommandControlType.vsCommandControlTypeButton);
  29.                         if (cmd2 == null)
  30.                             cmd2 = commands.AddNamedCommand2(_addInInstance, "VxPasteBinSettings", "Settings", "Set the settings for pastebin.", true, 59, ref contextGUIDS, (int)(vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported), (int)vsCommandStyle.vsCommandStyleText, vsCommandControlType.vsCommandControlTypeButton);
  31.  
  32.                         cmd.AddControl(toolsControl);
  33.                         cmd2.AddControl(pasteMenu.CommandBar);
  34.                         pasteMenu.Enabled = true;
  35.  
  36.                     }
  37.                     catch (System.Exception e)
  38.                     {
  39.                         System.Windows.Forms.MessageBox.Show(e.Message);
  40.                     }
  41.  
  42.                     mIsCmdLoaded = true;
  43.                 }
  44.             }
Advertisement
Add Comment
Please, Sign In to add comment