Example #1
0
        bool EnableTestAdapterCore(PrigViewModel vm)
        {
            vm.BeginProjectWideProcessProgress(ProjectWideProcesses.TestAdapterEnabling);


            var machinePreq = new MachinePrerequisite(Resources.NuGetRootPackageVersion);

            machinePreq.ProfilerStatusChecking += profLoc => vm.ReportProfilerStatusCheckingProgress(25u, profLoc);
            if (!MachineWideInstaller.HasBeenInstalled(machinePreq))
            {
                vm.ShowSkippedProjectWideProcessMessage(SkippedReasons.NotRegisteredYet, null);
                vm.EndSkippedProjectWideProcessProgress(SkippedReasons.NotRegisteredYet, null);
                return(false);
            }


            var projs = vm.GetTargetProjects(vm.GetCurrentProjectOrException().DTE);


            var command =
                @"
Import-Module ([IO.Path]::Combine($env:URASANDESU_PRIG_PACKAGE_FOLDER, 'tools\Urasandesu.Prig'))
Enable-PrigTestAdapter -Project $Project
";
            var mci = new ManagementCommandInfo(command, projs);

            mci.CommandExecuting += () => vm.ReportProcessingProjectWideProcessProgress(50u, projs);
            mci.CommandExecuted  += () => vm.EndCompletedProjectWideProcessProgress(projs);
            ManagementCommandExecutor.Execute(mci);

            return(true);
        }