Exemple #1
0
        protected override void Initialize()
        {
            base.Initialize();

            _dte = GetGlobalService(typeof(DTE)) as DTE;
            if (_dte == null)
            {
                return;
            }

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (mcs == null)
            {
                return;
            }

            //Item Templates
            ItemTemplateCommands itemCommands         = new ItemTemplateCommands(_dte);
            CommandID            pluginMenuCommandId1 = new CommandID(GuidList.GuidItMenuCommandsCmdSet, (int)PkgCmdIdList.CmdidAddItem1);
            OleMenuCommand       pluginMenuItem1      = new OleMenuCommand(itemCommands.MenuItem1Callback, pluginMenuCommandId1);

            pluginMenuItem1.BeforeQueryStatus += itemCommands.MenuItem1_BeforeQueryStatus;
            pluginMenuItem1.Visible            = false;
            mcs.AddCommand(pluginMenuItem1);

            CommandID      pluginMenuCommandId2 = new CommandID(GuidList.GuidItMenuCommandsCmdSet, (int)PkgCmdIdList.CmdidAddItem2);
            OleMenuCommand pluginMenuItem2      = new OleMenuCommand(itemCommands.MenuItem2Callback, pluginMenuCommandId2);

            pluginMenuItem2.BeforeQueryStatus += itemCommands.MenuItem2_BeforeQueryStatus;
            pluginMenuItem2.Visible            = false;
            mcs.AddCommand(pluginMenuItem2);

            CommandID      pluginMenuCommandId3 = new CommandID(GuidList.GuidItMenuCommandsCmdSet, (int)PkgCmdIdList.CmdidAddItem3);
            OleMenuCommand pluginMenuItem3      = new OleMenuCommand(itemCommands.MenuItem3Callback, pluginMenuCommandId3);

            pluginMenuItem3.BeforeQueryStatus += itemCommands.MenuItem3_BeforeQueryStatus;
            pluginMenuItem3.Visible            = false;
            mcs.AddCommand(pluginMenuItem3);

            //Web Resource Deployer
            CommandID      wrdWindowCommandId = new CommandID(GuidList.GuidCrmDevExCmdSet, (int)PkgCmdIdList.CmdidWebResourceDeployerWindow);
            OleMenuCommand wrdWindowItem      = new OleMenuCommand(ShowWrdToolWindow, wrdWindowCommandId);

            mcs.AddCommand(wrdWindowItem);

            //Report Deployer
            CommandID      reportWindowCommandId = new CommandID(GuidList.GuidCrmDevExCmdSet, (int)PkgCmdIdList.CmdidReportDeployerWindow);
            OleMenuCommand reportWindowItem      = new OleMenuCommand(ShowReportToolWindow, reportWindowCommandId);

            mcs.AddCommand(reportWindowItem);

            //Plug-in Deployer
            CommandID      pluginWindowCommandId = new CommandID(GuidList.GuidCrmDevExCmdSet, (int)PkgCmdIdList.CmdidPluginDeployerWindow);
            OleMenuCommand pluginWindowItem      = new OleMenuCommand(ShowPluginToolWindow, pluginWindowCommandId);

            mcs.AddCommand(pluginWindowItem);

            //Solution Packager
            CommandID      packagerWindowCommandId = new CommandID(GuidList.GuidCrmDevExCmdSet, (int)PkgCmdIdList.CmdidSolutionPackagerWindow);
            OleMenuCommand packageWindowItem       = new OleMenuCommand(ShowSolutionPackagerToolWindow, packagerWindowCommandId);

            mcs.AddCommand(packageWindowItem);

            //Enable Logging
            SharedConnection.EnableLogging(_dte);
        }