/// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var dte = CakePackage.Dte;

            if (dte == null)
            {
                return;
            }

            if (dte.Solution == null || dte.Solution.Count == 0)
            {
                ServiceProvider.ShowMessageBox("No solution opened");
            }
            else
            {
                if (MenuHelpers.DownloadFileToProject(Constants.DotNetFrameworkPowerShellUri, "build.ps1"))
                {
                    VsShellUtilities.LogMessage(Constants.PackageName, ".NET Framework PowerShell bootstrapper installed into solution", __ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION);
                    ServiceProvider.ShowMessageBox(".NET Framework PowerShell bootstrapper script successfully downloaded.");
                }
            }

            // Show a message box to prove we were here
        }
コード例 #2
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            var dte = CakePackage.Dte;

            if (dte == null)
            {
                return;
            }

            if (dte.Solution == null || dte.Solution.Count == 0)
            {
                ServiceProvider.ShowMessageBox("No solution opened");
            }
            else
            {
                if (MenuHelpers.DownloadFileToProject(Constants.ConfigTemplatePath, Constants.ConfigFileName,
                                                      MenuHelpers.ProjectInstallCommand))
                {
                    VsShellUtilities.LogMessage(Constants.PackageName, "Cake configuration file installed into solution",
                                                __ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION);
                    ServiceProvider.ShowMessageBox("Cake configuration file successfully downloaded.");
                }
            }
        }