Cromon

Connect.cs

Oct 7th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.38 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.                         var pasteMenu = (CommandBarPopup)toolsControl.Controls.Add(MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, 1, true);
  12.                         pasteMenu.CommandBar.Name = "VxPasteBin";
  13.                         pasteMenu.Caption = "VxPasteBin";
  14.  
  15.                         Command cmd = null;
  16.                         Command cmd2 = null;
  17.                         try
  18.                         {
  19.                             cmd = commands.Item(_addInInstance.ProgID + ".VxPasteBinUpload");
  20.                             cmd2 = commands.Item(_addInInstance.ProgID + ".VxPasteBinSettings");
  21.                         }
  22.                         catch (Exception)
  23.                         {
  24.                         }
  25.  
  26.                         if (cmd == null)
  27.                             cmd = commands.AddNamedCommand2(_addInInstance, "VxPasteBinUpload", "Upload", "Upload the code to pastebin!", true, 59, ref contextGUIDS, (int)(vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported), (int)vsCommandStyle.vsCommandStyleText, vsCommandControlType.vsCommandControlTypeButton);
  28.                         if (cmd2 == null)
  29.                             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);
  30.  
  31.                         cmd.AddControl(pasteMenu.CommandBar);
  32.                         cmd2.AddControl(pasteMenu.CommandBar, 2);
  33.                         pasteMenu.Enabled = true;
  34.  
  35.                     }
  36.                     catch (System.Exception e)
  37.                     {
  38.                         System.Windows.Forms.MessageBox.Show(e.Message);
  39.                     }
  40.  
  41.                     mIsCmdLoaded = true;
  42.                 }
  43.             }
Advertisement
Add Comment
Please, Sign In to add comment