GetCurrentProjectOrException() public method

public GetCurrentProjectOrException ( ) : Project
return Project
Exemplo n.º 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 proj = vm.GetCurrentProjectOrException();


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

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

            return(true);
        }
Exemplo n.º 2
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 proj = vm.GetCurrentProjectOrException();

            var command =
            @"
            Import-Module ([IO.Path]::Combine($env:URASANDESU_PRIG_PACKAGE_FOLDER, 'tools\Urasandesu.Prig'))
            Enable-PrigTestAdapter -Project $Project
            ";
            var mci = new ManagementCommandInfo(command, proj);
            mci.CommandExecuting += () => vm.ReportProcessingProjectWideProcessProgress(50u, proj.Name);
            mci.CommandExecuted += () => vm.EndCompletedProjectWideProcessProgress(proj.Name);
            ManagementCommandExecutor.Execute(mci);

            return true;
        }