Exemplo n.º 1
0
        void RemovePrigAssemblyCore(PrigPackageViewModel viewModel, string deletionalInclude)
        {
            if (viewModel.ShowMessageBox(string.Format("Are you sure you want to remove Prig assembly {0}?", deletionalInclude), OLEMSGBUTTON.OLEMSGBUTTON_YESNO, OLEMSGICON.OLEMSGICON_QUERY) != VSConstants.MessageBoxResult.IDYES)
                return;

            viewModel.Statusbar.BeginProgress();

            viewModel.Statusbar.ReportProgress("Checking current project's packages...", 25u, 100u);
            var project = MonitoringSelectionService.GetCurrentProject();
            if (!InstallerServices.IsPackageInstalledEx(project, Resources.NuGetRootPackageId, Resources.NuGetRootPackageVersion))
            {
                if (InstallerServices.IsPackageInstalled(project, Resources.NuGetRootPackageId))
                    Uninstaller.UninstallPackage(project, Resources.NuGetRootPackageId, false);
                InstallPackage(viewModel, project, Resources.NuGetRootPackageId, Resources.NuGetRootPackageVersion, 50u, 100u);
            }

            viewModel.Statusbar.ReportProgress("Starting the Prig setup session...", 75u, 100u);
            var command = string.Format(
            @"
            Import-Module ([IO.Path]::Combine($env:URASANDESU_PRIG_PACKAGE_FOLDER, 'tools\Urasandesu.Prig'))
            Start-PrigSetup -DeletionalInclude {0} -Project $Project
            ", deletionalInclude);
            ExecuteCommand(command, project);

            viewModel.Statusbar.ReportProgress(string.Format("Completed removing Prig assembly {0}.", deletionalInclude), 100u, 100u);
            viewModel.ShowMessageBox(string.Format("Completed removing Prig assembly {0}.", deletionalInclude), OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGICON.OLEMSGICON_INFO);
            viewModel.Statusbar.EndProgress();
            viewModel.Statusbar.Text.Value = string.Format("Completed removing Prig assembly {0}.", deletionalInclude);
        }