示例#1
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>
        protected override void MenuItemCallback(object sender, EventArgs e)
        {
            base.PreMenuItemCallback();

            m_solutionBrowser.CheckOutProjectVersionFiles(m_solutionBrowser.ProjectsToUpdate);
            SetupProjectsLoader spl = new SetupProjectsLoader(m_devEnvApplicationObject);

            spl.UnloadSetupProjects(m_solutionBrowser.ProjectsToUpdate);
            m_solutionBrowser.SaveVersions();
            spl.ReloadSetupProjects();

            bool runCommand = true;

            if (m_solutionBrowser.UpdateSummary.UpdatedItemsCount == 0)
            {
                runCommand = NoUpdateForm.Show(new WindowAdapter(m_devEnvApplicationObject.MainWindow.HWnd)) == DialogResult.Yes;
            }

            if (runCommand)
            {
                m_devEnvApplicationObject.ExecuteCommand("Build.RebuildSolution", "");
            }

            if (m_solutionBrowser.UpdateSummary.UpdatedItemsCount > 0 && ConfigurationPersister.Instance.Configuration.DisplayOptions.ShowSuccessDialog)
            {
                OperationSuccesForm.Show(new WindowAdapter(m_devEnvApplicationObject.MainWindow.HWnd), m_solutionBrowser.UpdateSummary.SummaryItems);
            }
        }
        /// <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>
        protected override void MenuItemCallback(object sender, EventArgs e)
        {
            base.PreMenuItemCallback();

            using (MainForm mainForm = new MainForm(m_solutionBrowser))
            {
#if DEBUG
                mainForm.ShowInTaskbar = true;
#endif
                WindowAdapter wa = new WindowAdapter(m_devEnvApplicationObject.MainWindow.HWnd);
                if (mainForm.ShowDialog(wa) != DialogResult.Cancel)
                {
                    ProjectInfo[] toCheckout = mainForm.MarkedProjects;
                    m_solutionBrowser.CheckOutProjectVersionFiles(toCheckout);
                    // setup projects have to be unloaded in order to avoid popup dialogs
                    SetupProjectsLoader spl = new SetupProjectsLoader(m_devEnvApplicationObject);
                    spl.UnloadSetupProjects(mainForm.MarkedProjects);
                    mainForm.SaveVersions();
                    spl.ReloadSetupProjects();
                    if (mainForm.CommandToPerform.Length != 0)
                    {
                        m_devEnvApplicationObject.ExecuteCommand(mainForm.CommandToPerform, "");
                    }
                }
            }
        }