ReportProfilerStatusCheckingProgress() private method

private ReportProfilerStatusCheckingProgress ( uint prog, ProfilerLocation profLoc ) : void
prog uint
profLoc ProfilerLocation
return void
Exemplo n.º 1
0
        bool DisableTestAdapterCore(PrigViewModel vm)
        {
            vm.BeginProjectWideProcessProgress(ProjectWideProcesses.TestAdapterDisabling);


            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 command =
                @"
Import-Module ([IO.Path]::Combine($env:URASANDESU_PRIG_PACKAGE_FOLDER, 'tools\Urasandesu.Prig'))
Disable-PrigTestAdapter
";
            var mci = new ManagementCommandInfo(command);

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

            return(true);
        }
Exemplo n.º 2
0
        public virtual void PrepareUnregisteringPrig(PrigViewModel vm)
        {
            vm.BeginMachineWideProcessProgress(MachineWideProcesses.Uninstalling);

            var machinePreq = new MachinePrerequisite(Resources.NuGetRootPackageVersion);

            machinePreq.ProfilerStatusChecking += profLoc => vm.ReportProfilerStatusCheckingProgress(50u, profLoc);

            if (!MachineWideInstaller.HasBeenInstalled(machinePreq))
            {
                vm.ShowSkippedMachineWideProcessMessage(SkippedReasons.AlreadyRegistered);
                vm.EndSkippedMachineWideProcessProgress(SkippedReasons.AlreadyRegistered);
                return;
            }


            if (!WindowsIdentity.GetCurrent().IsElevated())
            {
                vm.ShowVisualStudioHasNotBeenElevatedYetMessage();
                if (ProcessMixin.RestartCurrentProcessWith(_ => { _.Verb = "runas"; }))
                {
                    return;
                }

                vm.EndSkippedMachineWideProcessProgress(SkippedReasons.CanceledByUser);
            }
            else
            {
                UnregisterPrig(vm);
            }
        }
Exemplo n.º 3
0
        void RemovePrigAssemblyCore(PrigViewModel vm, string deletionalInclude)
        {
            vm.BeginProjectWideProcessProgress(ProjectWideProcesses.PrigAssemblyRemoving);


            var machinePreq = new MachinePrerequisite(Resources.NuGetRootPackageVersion);

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


            if (!vm.ConfirmRemovingPrigAssembly(deletionalInclude))
            {
                return;
            }


            var proj = MonitoringSelectionService.GetCurrentProject();


            var pwPkg = new ProjectWidePackage(Resources.NuGetRootPackageId, Resources.NuGetRootPackageVersion, proj);

            pwPkg.PackagePreparing      += () => vm.ReportPackagePreparingProgress(25u);
            pwPkg.PackageInstalling     += metadata => vm.ReportPackageInstallingProgress(50u, metadata);
            pwPkg.PackageInstalled      += metadata => vm.ReportPackageInstalledProgress(50u, metadata);
            pwPkg.PackageReferenceAdded += metadata => vm.ReportPackageReferenceAddedProgress(50u, metadata);
            ProjectWideInstaller.Install(pwPkg);


            var command = string.Format(
                @"
Import-Module ([IO.Path]::Combine($env:URASANDESU_PRIG_PACKAGE_FOLDER, 'tools\Urasandesu.Prig'))
Start-PrigSetup -DeletionalInclude {0} -Project $Project
", deletionalInclude);
            var mci = new ManagementCommandInfo(command, proj);

            mci.CommandExecuting += () => vm.ReportProcessingProjectWideProcessProgress(75u, deletionalInclude);
            mci.CommandExecuted  +=
                () =>
            {
                vm.ShowCompletedProjectWideProcessMessage(deletionalInclude);
                vm.EndCompletedProjectWideProcessProgress(deletionalInclude);
            };
            ManagementCommandExecutor.Execute(mci);
        }
Exemplo n.º 4
0
        public virtual void UnregisterPrig(PrigViewModel vm)
        {
            var umwPkg = new MachineWideUninstallation(Resources.NuGetRootPackageVersion);

            umwPkg.Preparing += () => vm.BeginMachineWideProcessProgress(MachineWideProcesses.Uninstalling);
            umwPkg.ProfilerStatusChecking           += profLoc => vm.ReportProfilerStatusCheckingProgress(10u, profLoc);
            umwPkg.PrigSourceUninstalling           += pkgName => vm.ReportPrigSourceProcessingProgress(20u, pkgName, null);
            umwPkg.PrigSourceUninstalled            += stdout => vm.ReportPrigSourceProcessedProgress(30u, stdout);
            umwPkg.ProfilerUnregistering            += profLoc => vm.ReportProfilerProcessingProgress(40u, profLoc);
            umwPkg.ProfilerUnregistered             += stdout => vm.ReportProfilerProcessedProgress(50u, stdout);
            umwPkg.EnvironmentVariableUnregistering += name => vm.ReportEnvironmentVariableProcessingProgress(60u, name, null);
            umwPkg.EnvironmentVariableUnregistered  += name => vm.ReportEnvironmentVariableProcessedProgress(70u);
            umwPkg.NuGetSourceUnregistering         += name => vm.ReportNuGetSourceProcessingProgress(80u, name, null);
            umwPkg.NuGetSourceUnregistered          += stdout => vm.ReportNuGetSourceProcessedProgress(90u, stdout);
            umwPkg.Completed += result => OnCompletedUnregisterPrig(vm, result);

            MachineWideInstaller.Uninstall(umwPkg);
        }
Exemplo n.º 5
0
        void RegisterPrig(PrigViewModel vm)
        {
            var mwInstl = new MachineWideInstallation(Resources.NuGetRootPackageVersion);

            mwInstl.Preparing += () => vm.BeginMachineWideProcessProgress(MachineWideProcesses.Installing);
            mwInstl.ProfilerStatusChecking         += profLoc => vm.ReportProfilerStatusCheckingProgress(8u, profLoc);
            mwInstl.NuGetPackageCreating           += pkgName => vm.ReportNuGetPackageCreatingProgress(17u, pkgName);
            mwInstl.NuGetPackageCreated            += stdout => vm.ReportNuGetPackageCreatedProgress(25u, stdout);
            mwInstl.NuGetSourceRegistering         += (path, name) => vm.ReportNuGetSourceProcessingProgress(33u, path, name);
            mwInstl.NuGetSourceRegistered          += stdout => vm.ReportNuGetSourceProcessedProgress(42u, stdout);
            mwInstl.EnvironmentVariableRegistering += (name, value) => vm.ReportEnvironmentVariableProcessingProgress(50u, name, value);
            mwInstl.EnvironmentVariableRegistered  += (name, value) => vm.ReportEnvironmentVariableProcessedProgress(58u);
            mwInstl.ProfilerRegistering            += profLoc => vm.ReportProfilerProcessingProgress(67u, profLoc);
            mwInstl.ProfilerRegistered             += stdout => vm.ReportProfilerProcessedProgress(75u, stdout);
            mwInstl.PrigSourceInstalling           += (pkgName, src) => vm.ReportPrigSourceProcessingProgress(83u, pkgName, src);
            mwInstl.PrigSourceInstalled            += stdout => vm.ReportPrigSourceProcessedProgress(92u, stdout);
            mwInstl.Completed += result => OnCompletedRegisterPrig(vm, result);

            MachineWideInstaller.Install(mwInstl);
        }
Exemplo n.º 6
0
        void RemovePrigAssemblyCore(PrigViewModel vm, string deletionalInclude)
        {
            vm.BeginProjectWideProcessProgress(ProjectWideProcesses.PrigAssemblyRemoving);

            var machinePreq = new MachinePrerequisite(Resources.NuGetRootPackageVersion);
            machinePreq.ProfilerStatusChecking += profLoc => vm.ReportProfilerStatusCheckingProgress(13u, profLoc);
            if (!MachineWideInstaller.HasBeenInstalled(machinePreq))
            {
                vm.ShowSkippedProjectWideProcessMessage(SkippedReasons.NotRegisteredYet, deletionalInclude);
                vm.EndSkippedProjectWideProcessProgress(SkippedReasons.NotRegisteredYet, deletionalInclude);
                return;
            }

            if (!vm.ConfirmRemovingPrigAssembly(deletionalInclude))
                return;

            var proj = MonitoringSelectionService.GetCurrentProject();

            var pwPkg = new ProjectWidePackage(Resources.NuGetRootPackageId, Resources.NuGetRootPackageVersion, proj);
            pwPkg.PackagePreparing += () => vm.ReportPackagePreparingProgress(25u);
            pwPkg.PackageInstalling += metadata => vm.ReportPackageInstallingProgress(50u, metadata);
            pwPkg.PackageInstalled += metadata => vm.ReportPackageInstalledProgress(50u, metadata);
            pwPkg.PackageReferenceAdded += metadata => vm.ReportPackageReferenceAddedProgress(50u, metadata);
            ProjectWideInstaller.Install(pwPkg);

            var command = string.Format(
            @"
            Import-Module ([IO.Path]::Combine($env:URASANDESU_PRIG_PACKAGE_FOLDER, 'tools\Urasandesu.Prig'))
            Start-PrigSetup -DeletionalInclude {0} -Project $Project
            ", deletionalInclude);
            var mci = new ManagementCommandInfo(command, proj);
            mci.CommandExecuting += () => vm.ReportProcessingProjectWideProcessProgress(75u, deletionalInclude);
            mci.CommandExecuted +=
                () =>
                {
                    vm.ShowCompletedProjectWideProcessMessage(deletionalInclude);
                    vm.EndCompletedProjectWideProcessProgress(deletionalInclude);
                };
            ManagementCommandExecutor.Execute(mci);
        }
Exemplo n.º 7
0
        void RegisterPrig(PrigViewModel vm)
        {
            var mwInstl = new MachineWideInstallation(Resources.NuGetRootPackageVersion);
            mwInstl.Preparing += () => vm.BeginMachineWideProcessProgress(MachineWideProcesses.Installing);
            mwInstl.ProfilerStatusChecking += profLoc => vm.ReportProfilerStatusCheckingProgress(8u, profLoc);
            mwInstl.NuGetPackageCreating += pkgName => vm.ReportNuGetPackageCreatingProgress(17u, pkgName);
            mwInstl.NuGetPackageCreated += stdout => vm.ReportNuGetPackageCreatedProgress(25u, stdout);
            mwInstl.NuGetSourceRegistering += (path, name) => vm.ReportNuGetSourceProcessingProgress(33u, path, name);
            mwInstl.NuGetSourceRegistered += stdout => vm.ReportNuGetSourceProcessedProgress(42u, stdout);
            mwInstl.EnvironmentVariableRegistering += (name, value) => vm.ReportEnvironmentVariableProcessingProgress(50u, name, value);
            mwInstl.EnvironmentVariableRegistered += (name, value) => vm.ReportEnvironmentVariableProcessedProgress(58u);
            mwInstl.ProfilerRegistering += profLoc => vm.ReportProfilerProcessingProgress(67u, profLoc);
            mwInstl.ProfilerRegistered += stdout => vm.ReportProfilerProcessedProgress(75u, stdout);
            mwInstl.PrigSourceInstalling += (pkgName, src) => vm.ReportPrigSourceProcessingProgress(83u, pkgName, src);
            mwInstl.PrigSourceInstalled += stdout => vm.ReportPrigSourceProcessedProgress(92u, stdout);
            mwInstl.Completed += result => OnCompletedRegisterPrig(vm, result);

            MachineWideInstaller.Install(mwInstl);
        }
Exemplo n.º 8
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.º 9
0
        public virtual void UnregisterPrig(PrigViewModel vm)
        {
            var umwPkg = new MachineWideUninstallation(Resources.NuGetRootPackageVersion);
            umwPkg.Preparing += () => vm.BeginMachineWideProcessProgress(MachineWideProcesses.Uninstalling);
            umwPkg.ProfilerStatusChecking += profLoc => vm.ReportProfilerStatusCheckingProgress(10u, profLoc);
            umwPkg.PrigSourceUninstalling += pkgName => vm.ReportPrigSourceProcessingProgress(20u, pkgName, null);
            umwPkg.PrigSourceUninstalled += stdout => vm.ReportPrigSourceProcessedProgress(30u, stdout);
            umwPkg.ProfilerUnregistering += profLoc => vm.ReportProfilerProcessingProgress(40u, profLoc);
            umwPkg.ProfilerUnregistered += stdout => vm.ReportProfilerProcessedProgress(50u, stdout);
            umwPkg.EnvironmentVariableUnregistering += name => vm.ReportEnvironmentVariableProcessingProgress(60u, name, null);
            umwPkg.EnvironmentVariableUnregistered += name => vm.ReportEnvironmentVariableProcessedProgress(70u);
            umwPkg.NuGetSourceUnregistering += name => vm.ReportNuGetSourceProcessingProgress(80u, name, null);
            umwPkg.NuGetSourceUnregistered += stdout => vm.ReportNuGetSourceProcessedProgress(90u, stdout);
            umwPkg.Completed += result => OnCompletedUnregisterPrig(vm, result);

            MachineWideInstaller.Uninstall(umwPkg);
        }
Exemplo n.º 10
0
        public virtual void PrepareUnregisteringPrig(PrigViewModel vm)
        {
            vm.BeginMachineWideProcessProgress(MachineWideProcesses.Uninstalling);

            var machinePreq = new MachinePrerequisite(Resources.NuGetRootPackageVersion);
            machinePreq.ProfilerStatusChecking += profLoc => vm.ReportProfilerStatusCheckingProgress(50u, profLoc);

            if (!MachineWideInstaller.HasBeenInstalled(machinePreq))
            {
                vm.ShowSkippedMachineWideProcessMessage(SkippedReasons.AlreadyRegistered);
                vm.EndSkippedMachineWideProcessProgress(SkippedReasons.AlreadyRegistered);
                return;
            }

            if (!WindowsIdentity.GetCurrent().IsElevated())
            {
                vm.ShowVisualStudioHasNotBeenElevatedYetMessage();
                if (ProcessMixin.RestartCurrentProcessWith(_ => { _.Verb = "runas"; }))
                    return;

                vm.EndSkippedMachineWideProcessProgress(SkippedReasons.CanceledByUser);
            }
            else
            {
                UnregisterPrig(vm);
            }
        }