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

            DTE dte = GetGlobalService(typeof(DTE)) as DTE;

            StartupTasks.Run(dte);

            ExLogger.LogToFile(Logger, Resource.TraceInfo_InitializingExtension, LogLevel.Info);

            if (!(GetService(typeof(IMenuCommandService)) is OleMenuCommandService mcs))
            {
                return;
            }

            //Plug-in Deployer
            CommandID      pdWindowCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidPluginDeployerWindow);
            OleMenuCommand pdWindowItem      = new OleMenuCommand(ShowToolWindow <PluginDeployerHost>, pdWindowCommandId);

            mcs.AddCommand(pdWindowItem);

            //Web Resource Deployer
            CommandID      wrdWindowCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidWebResourceDeployerWindow);
            OleMenuCommand wrdWindowItem      = new OleMenuCommand(ShowToolWindow <WebResourceDeployerHost>, wrdWindowCommandId);

            mcs.AddCommand(wrdWindowItem);

            //Solution Packager
            CommandID      spWindowCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidSolutionPackagerWindow);
            OleMenuCommand spWindowItem      = new OleMenuCommand(ShowToolWindow <SolutionPackagerHost>, spWindowCommandId);

            mcs.AddCommand(spWindowItem);

            //Plug-in Trace Viewer
            CommandID      ptvWindowCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidPluginTraceViewerWindow);
            OleMenuCommand ptvWindowItem      = new OleMenuCommand(ShowToolWindow <PluginTraceViewerHost>, ptvWindowCommandId);

            mcs.AddCommand(ptvWindowItem);

            //NuGet SDK Tools - Core Tools
            CommandID      nugetSdkToolsCoreCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidNuGetSdkToolsCore);
            OleMenuCommand nugetSdkToolsCoreItem      = new OleMenuCommand(InstallNuGetCliPackage, nugetSdkToolsCoreCommandId);

            mcs.AddCommand(nugetSdkToolsCoreItem);

            //NuGet SDK Tools - Plug-in Registration Tool
            CommandID      nugetSdkToolsPrtCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidNuGetSdkToolsPrt);
            OleMenuCommand nugetSdkToolsPrtItem      = new OleMenuCommand(InstallNuGetCliPackage, nugetSdkToolsPrtCommandId);

            mcs.AddCommand(nugetSdkToolsPrtItem);
        }
        protected override void Initialize()
        {
            base.Initialize();

            _dte = GetGlobalService(typeof(DTE)) as DTE;

            ExLogger.LogToFile(_dte, ExtensionLogger, "Initializing extension", LogLevel.Info);

            StartupTasks.Run(_dte);

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

            if (mcs == null)
            {
                return;
            }

            //Plug-in Deployer
            CommandID      pdWindowCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidPluginDeployerWindow);
            OleMenuCommand pdWindowItem      = new OleMenuCommand(ShowToolWindow <PluginDeployerHost>, pdWindowCommandId);

            mcs.AddCommand(pdWindowItem);

            //Web Resource Deployer
            CommandID      wrdWindowCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidWebResourceDeployerWindow);
            OleMenuCommand wrdWindowItem      = new OleMenuCommand(ShowToolWindow <WebResourceDeployerHost>, wrdWindowCommandId);

            mcs.AddCommand(wrdWindowItem);

            //Solution Packager
            CommandID      spWindowCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidSolutionPackagerWindow);
            OleMenuCommand spWindowItem      = new OleMenuCommand(ShowToolWindow <SolutionPackagerHost>, spWindowCommandId);

            mcs.AddCommand(spWindowItem);

            //Plug-in Trace Viewer
            CommandID      ptvWindowCommandId = new CommandID(PackageGuids.GuidCrmDevExCmdSet, PackageIds.CmdidPluginTraceViewerWindow);
            OleMenuCommand ptvWindowItem      = new OleMenuCommand(ShowToolWindow <PluginTraceViewerHost>, ptvWindowCommandId);

            mcs.AddCommand(ptvWindowItem);
        }