2 using System.ComponentModel.Design;
4 using Microsoft.VisualStudio.Shell;
5 using Microsoft.VisualStudio.Shell.Interop;
9 namespace sage.addons.components
14 internal sealed
class AddonComponentButton
19 public const int CommandId = 0x0100;
24 public static readonly Guid CommandSet =
new Guid(
"fbd92ea9-29f2-411c-8088-b0b2189e19d5");
29 private readonly Package package;
36 private AddonComponentButton(Package package)
40 throw new ArgumentNullException(
"package");
43 this.
package = package;
45 OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
46 if (commandService != null)
48 var menuCommandID =
new CommandID(CommandSet, CommandId);
49 var menuItem =
new MenuCommand(this.MenuItemCallback, menuCommandID);
50 commandService.AddCommand(menuItem);
57 public static AddonComponentButton Instance
66 private IServiceProvider ServiceProvider
78 public static void Initialize(Package package)
80 Instance =
new AddonComponentButton(package);
90 private void MenuItemCallback(
object sender, EventArgs e)
92 Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
94 DTE2 dte = (DTE2)Instance.ServiceProvider.GetService(typeof(DTE));
98 addonsExecute.
Execute(dte,
"Manteniment");
Funciones y métodos para crear los componentes
void Execute(DTE2 dte, string commandName)
Executes the assistant