Inheritance: Urasandesu.Prig.VSPackage.Infrastructure.PackageViewModel
Exemple #1
0
 public virtual void EnableTestAdapter(PrigViewModel vm)
 {
     if (EnableTestAdapterCore(vm))
     {
         vm.IsTestAdapterEnabled.Value = true;
     }
 }
Exemple #2
0
 public virtual void DisableTestAdapter(PrigViewModel vm)
 {
     if (DisableTestAdapterCore(vm))
     {
         vm.IsTestAdapterEnabled.Value = false;
     }
 }
Exemple #3
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);
        }
Exemple #4
0
        public void NewDisableTestAdapterCommand_should_bind_Text_property_to_CurrentProject_status()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());
            var projName = fixture.Create<string>();
            {
                var m = fixture.Freeze<Mock<Project>>();
                m.Setup(_ => _.Name).Returns(projName);
            }

            var vm = new PrigViewModel();
            var menuCommand = PrigPackage.NewDisableTestAdapterCommand(vm);
            menuCommand.Text = null;

            // Act
            vm.CurrentProject.Value = null;
            var defaultText = menuCommand.Text;
            vm.CurrentProject.Value = fixture.Freeze<Project>();
            var projectSelectedText = menuCommand.Text;

            // Assert
            Assert.IsNotNull(defaultText);
            Assert.AreNotEqual(defaultText, projectSelectedText);
            Assert.That(projectSelectedText, Is.StringMatching(projName));
        }
Exemple #5
0
        public virtual void RemovePrigAssembly(PrigViewModel vm)
        {
            var projItem          = MonitoringSelectionService.GetSelectedItem <ProjectItem>();
            var deletionalInclude = Regex.Replace(projItem.Name, @"(.*)\.prig$", "$1");

            RemovePrigAssemblyCore(vm, deletionalInclude);
        }
Exemple #6
0
        public virtual void EditPrigIndirectionSettings(PrigViewModel vm)
        {
            var projItem         = MonitoringSelectionService.GetSelectedItem <ProjectItem>();
            var editorialInclude = Regex.Replace(projItem.Name, @"(.*)\.v\d+\.\d+\.\d+\.v\d+\.\d+\.\d+\.\d+\.prig", "$1");

            EditPrigIndirectionSettingsCore(vm, editorialInclude);
        }
Exemple #7
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);
            }
        }
Exemple #8
0
        static MenuCommand NewAddPrigAssemblyCommand(PrigViewModel vm)
        {
            var commandId   = new CommandID(GuidList.AddPrigAssemblyGroup, (int)PkgCmdIDList.AddPrigAssemblyCommand);
            var handler     = new EventHandler((sender, e) => vm.AddPrigAssemblyCommand.Execute(sender));
            var menuCommand = new MenuCommand(handler, commandId);

            return(menuCommand);
        }
Exemple #9
0
        static MenuCommand NewUnregisterPrigCommand(PrigViewModel vm)
        {
            var commandId   = new CommandID(GuidList.RegistrationMenuGroup, (int)PkgCmdIDList.UnregisterPrigCommand);
            var handler     = new EventHandler((sender, e) => vm.UnregisterPrigCommand.Execute(sender));
            var menuCommand = new MenuCommand(handler, commandId);

            return(menuCommand);
        }
Exemple #10
0
        public virtual void OnProjectRemoved(PrigViewModel vm, Project proj)
        {
            if (!vm.HasEnabledTestAdapter(proj))
            {
                return;
            }

            DisableTestAdapter(vm);
        }
Exemple #11
0
        internal static OleMenuCommand NewDisableTestAdapterCommand(PrigViewModel vm)
        {
            var commandId   = new CommandID(GuidList.MainMenuGroup, (int)PkgCmdIDList.DisableTestAdapterCommand);
            var handler     = new EventHandler((sender, e) => vm.DisableTestAdapterCommand.Execute(sender));
            var menuCommand = new OleMenuCommand(handler, commandId);

            vm.DisableTestAdapterCommand.CanExecuteChanged += (sender, e) => menuCommand.Enabled = ((ICommand)sender).CanExecute(menuCommand);
            menuCommand.Enabled = false;
            return(menuCommand);
        }
Exemple #12
0
        static OleMenuCommand NewRemovePrigAssemblyCommand(PrigViewModel vm)
        {
            var commandId   = new CommandID(GuidList.EditPrigIndirectionSettingsGroup, (int)PkgCmdIDList.RemovePrigAssemblyCommand);
            var handler     = new EventHandler((sender, e) => vm.RemovePrigAssemblyCommand.Execute(sender));
            var menuCommand = new OleMenuCommand(handler, commandId);

            vm.RemovePrigAssemblyCommand.CanExecuteChanged += (sender, e) => menuCommand.Enabled = ((ICommand)sender).CanExecute(menuCommand);
            menuCommand.BeforeQueryStatus += (sender, e) => vm.EditPrigIndirectionSettingsBeforeQueryStatusCommand.Execute(sender);
            vm.IsEditPrigIndirectionSettingsCommandVisible.Subscribe(_ => menuCommand.Visible = _);
            return(menuCommand);
        }
Exemple #13
0
 public virtual void OnBuildDone(PrigViewModel vm)
 {
     if (!vm.HasEnabledTestAdapter())
     {
         DisableTestAdapter(vm);
     }
     else
     {
         EnableTestAdapterCore(vm);
     }
 }
Exemple #14
0
        public virtual void BeforeQueryStatusTestAdapter(PrigViewModel vm)
        {
            if (vm.IsTestAdapterEnabled.Value)
            {
                return;
            }

            var proj = MonitoringSelectionService.GetCurrentProject();

            vm.SetToCurrentProjectIfSupported(proj);
        }
Exemple #15
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);
        }
Exemple #16
0
        internal static OleMenuCommand NewDisableTestAdapterCommand(PrigViewModel vm)
        {
            var commandId   = new CommandID(GuidList.MainMenuGroup, (int)PkgCmdIDList.DisableTestAdapterCommand);
            var handler     = new EventHandler((sender, e) => vm.DisableTestAdapterCommand.Execute(sender));
            var menuCommand = new OleMenuCommand(handler, commandId);

            vm.DisableTestAdapterCommand.CanExecuteChanged += (sender, e) => menuCommand.Enabled = ((ICommand)sender).CanExecute(menuCommand);
            menuCommand.Enabled = false;
            var text = PrigResources.GetString("DisableTestAdapterMenu");

            vm.CurrentProject.Subscribe(
                proj => menuCommand.Text = proj == null ? text : string.Format(PrigResources.GetString("_0_For_1_MenuFormat"), text, proj.Name));
            return(menuCommand);
        }
Exemple #17
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);
        }
Exemple #18
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);
        }
Exemple #19
0
        protected virtual void OnCompletedUnregisterPrig(PrigViewModel vm, MachineWideProcessResults result)
        {
            switch (result)
            {
            case MachineWideProcessResults.Skipped:
                vm.ShowSkippedMachineWideProcessMessage(SkippedReasons.AlreadyRegistered);
                vm.EndSkippedMachineWideProcessProgress(SkippedReasons.AlreadyRegistered);
                break;

            case MachineWideProcessResults.Completed:
                var restarts = vm.ConfirmRestartingVisualStudioToTakeEffect();
                vm.EndCompletedMachineWideProcessProgress();
                if (!restarts)
                {
                    return;
                }

                ProcessMixin.RestartCurrentProcess();
                break;
            }
        }
Exemple #20
0
 public UnregisterPrigCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #21
0
        public virtual void BeforeQueryStatusEditPrigIndirectionSettings(PrigViewModel vm)
        {
            var projItem = MonitoringSelectionService.GetSelectedItem <ProjectItem>();

            vm.SetEditPrigIndirectionSettingsCommandVisibility(projItem);
        }
Exemple #22
0
 public virtual void OnBuildDone(PrigViewModel vm)
 {
     if (!vm.HasEnabledTestAdapter())
         DisableTestAdapter(vm);
     else
         EnableTestAdapterCore(vm);
 }
Exemple #23
0
 static OleMenuCommand NewRemovePrigAssemblyCommand(PrigViewModel vm)
 {
     var commandId = new CommandID(GuidList.EditPrigIndirectionSettingsGroup, (int)PkgCmdIDList.RemovePrigAssemblyCommand);
     var handler = new EventHandler((sender, e) => vm.RemovePrigAssemblyCommand.Execute(sender));
     var menuCommand = new OleMenuCommand(handler, commandId);
     vm.RemovePrigAssemblyCommand.CanExecuteChanged += (sender, e) => menuCommand.Enabled = ((ICommand)sender).CanExecute(menuCommand);
     menuCommand.BeforeQueryStatus += (sender, e) => vm.EditPrigIndirectionSettingsBeforeQueryStatusCommand.Execute(sender);
     vm.IsEditPrigIndirectionSettingsCommandVisible.Subscribe(_ => menuCommand.Visible = _);
     return menuCommand;
 }
Exemple #24
0
 public AddPrigAssemblyCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #25
0
 protected PrigCommand(PrigViewModel vm, IObservable <bool> canExecuteSource)
     : base(vm, canExecuteSource)
 {
 }
Exemple #26
0
 public virtual void EditPrigIndirectionSettings(PrigViewModel vm)
 {
     var projItem = MonitoringSelectionService.GetSelectedItem<ProjectItem>();
     var editorialInclude = Regex.Replace(projItem.Name, @"(.*)\.v\d+\.\d+\.\d+\.v\d+\.\d+\.\d+\.\d+\.prig", "$1");
     EditPrigIndirectionSettingsCore(vm, editorialInclude);
 }
Exemple #27
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;
        }
Exemple #28
0
        protected virtual void OnCompletedUnregisterPrig(PrigViewModel vm, MachineWideProcessResults result)
        {
            switch (result)
            {
                case MachineWideProcessResults.Skipped:
                    vm.ShowSkippedMachineWideProcessMessage(SkippedReasons.AlreadyRegistered);
                    vm.EndSkippedMachineWideProcessProgress(SkippedReasons.AlreadyRegistered);
                    break;
                case MachineWideProcessResults.Completed:
                    var restarts = vm.ConfirmRestartingVisualStudioToTakeEffect();
                    vm.EndCompletedMachineWideProcessProgress();
                    if (!restarts)
                        return;

                    ProcessMixin.RestartCurrentProcess();
                    break;
            }
        }
Exemple #29
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);
        }
Exemple #30
0
 public virtual void RemovePrigAssembly(PrigViewModel vm)
 {
     var projItem = MonitoringSelectionService.GetSelectedItem<ProjectItem>();
     var deletionalInclude = Regex.Replace(projItem.Name, @"(.*)\.prig$", "$1");
     RemovePrigAssemblyCore(vm, deletionalInclude);
 }
Exemple #31
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);
            }
        }
Exemple #32
0
        public virtual void OnProjectRemoved(PrigViewModel vm, Project proj)
        {
            if (!vm.HasEnabledTestAdapter(proj))
                return;

            DisableTestAdapter(vm);
        }
Exemple #33
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);
        }
Exemple #34
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);
        }
Exemple #35
0
 protected PrigCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #36
0
 public virtual void AddPrigAssembly(PrigViewModel vm)
 {
     AddPrigAssemblyCore(vm, MonitoringSelectionService.GetSelectedItem<Reference5>().Identity);
 }
Exemple #37
0
 public AddPrigAssemblyForMSCorLibCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #38
0
 static MenuCommand NewAddPrigAssemblyForMSCorLibCommand(PrigViewModel vm)
 {
     var commandId = new CommandID(GuidList.AddPrigAssemblyForMSCorLibGroup, (int)PkgCmdIDList.AddPrigAssemblyForMSCorLibCommand);
     var handler = new EventHandler((sender, e) => vm.AddPrigAssemblyForMSCorLibCommand.Execute(sender));
     var menuCommand = new MenuCommand(handler, commandId);
     return menuCommand;
 }
Exemple #39
0
 public EnableTestAdapterCommand(PrigViewModel vm, IObservable <bool> canExecuteSource)
     : base(vm, canExecuteSource)
 {
 }
Exemple #40
0
 public DisableTestAdapterCommand(PrigViewModel vm, IObservable<bool> canExecuteSource)
     : base(vm, canExecuteSource)
 {
 }
Exemple #41
0
 static MenuCommand NewUnregisterPrigCommand(PrigViewModel vm)
 {
     var commandId = new CommandID(GuidList.RegistrationMenuGroup, (int)PkgCmdIDList.UnregisterPrigCommand);
     var handler = new EventHandler((sender, e) => vm.UnregisterPrigCommand.Execute(sender));
     var menuCommand = new MenuCommand(handler, commandId);
     return menuCommand;
 }
Exemple #42
0
 public virtual void EnableTestAdapter(PrigViewModel vm)
 {
     if (EnableTestAdapterCore(vm))
         vm.IsTestAdapterEnabled.Value = true;
 }
Exemple #43
0
 internal static OleMenuCommand NewEnableTestAdapterCommand(PrigViewModel vm)
 {
     var commandId = new CommandID(GuidList.MainMenuGroup, (int)PkgCmdIDList.EnableTestAdapterCommand);
     var handler = new EventHandler((sender, e) => vm.EnableTestAdapterCommand.Execute(sender));
     var menuCommand = new OleMenuCommand(handler, commandId);
     vm.EnableTestAdapterCommand.CanExecuteChanged += (sender, e) => menuCommand.Enabled = ((ICommand)sender).CanExecute(menuCommand);
     menuCommand.BeforeQueryStatus += (sender, e) => vm.TestAdapterBeforeQueryStatusCommand.Execute(sender);
     var text = PrigResources.GetString("EnableTestAdapterMenu");
     vm.CurrentProject.Subscribe(
         proj => menuCommand.Text = proj == null ? text : string.Format(PrigResources.GetString("_0_For_1_MenuFormat"), text, proj.Name));
     return menuCommand;
 }
Exemple #44
0
 public virtual void AddPrigAssembly(PrigViewModel vm)
 {
     AddPrigAssemblyCore(vm, MonitoringSelectionService.GetSelectedItem <Reference5>().Identity);
 }
Exemple #45
0
 public AddPrigAssemblyForMSCorLibCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #46
0
 public RemovePrigAssemblyCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #47
0
 public AddPrigAssemblyCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #48
0
 public RemovePrigAssemblyCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #49
0
 public TestAdapterBeforeQueryStatusCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #50
0
 public EditPrigIndirectionSettingsBeforeQueryStatusCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #51
0
 public OnBuildDoneCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #52
0
 public ProjectRemovedCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #53
0
 public virtual void AddPrigAssemblyForMSCorLib(PrigViewModel vm)
 {
     AddPrigAssemblyCore(vm, "mscorlib");
 }
Exemple #54
0
 public virtual void DisableTestAdapter(PrigViewModel vm)
 {
     if (DisableTestAdapterCore(vm))
         vm.IsTestAdapterEnabled.Value = false;
 }
Exemple #55
0
 public virtual void AddPrigAssemblyForMSCorLib(PrigViewModel vm)
 {
     AddPrigAssemblyCore(vm, "mscorlib");
 }
Exemple #56
0
 protected PrigCommand(PrigViewModel vm, IObservable<bool> canExecuteSource)
     : base(vm, canExecuteSource)
 {
 }
Exemple #57
0
 public virtual void BeforeQueryStatusEditPrigIndirectionSettings(PrigViewModel vm)
 {
     var projItem = MonitoringSelectionService.GetSelectedItem<ProjectItem>();
     vm.SetEditPrigIndirectionSettingsCommandVisibility(projItem);
 }
Exemple #58
0
 public ProjectRemovedCommand(PrigViewModel vm)
     : base(vm)
 {
 }
Exemple #59
0
        public virtual void BeforeQueryStatusTestAdapter(PrigViewModel vm)
        {
            if (vm.IsTestAdapterEnabled.Value)
                return;

            var proj = MonitoringSelectionService.GetCurrentProject();
            vm.SetToCurrentProjectIfSupported(proj);
        }
Exemple #60
0
 protected PrigCommand(PrigViewModel vm)
     : base(vm)
 {
 }