private static bool InstallOrUninstallWithElevationContext(IEnumerable <ComponentHandle <IInstaller, InstallerTraits> > installerHandles, IElevationContext elevationContext, IProgressMonitor progressMonitor, InstallerOperation operation) { foreach (var installerHandle in installerHandles) { if (progressMonitor.IsCanceled) { return(false); } IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1); if (elevationContext != null && installerHandle.GetTraits().RequiresElevation) { elevationContext.Execute(InstallerElevatedCommand.ElevatedCommandId, new InstallerElevatedCommand.Arguments(installerHandle.Id, operation), subProgressMonitor); } else { IInstaller installer = installerHandle.GetComponent(); if (operation == InstallerOperation.Install) { installer.Install(progressMonitor.CreateSubProgressMonitor(1)); } else { installer.Uninstall(progressMonitor.CreateSubProgressMonitor(1)); } } } return(true); }
private static bool InstallOrUninstallWithElevationContext(IEnumerable<ComponentHandle<IInstaller, InstallerTraits>> installerHandles, IElevationContext elevationContext, IProgressMonitor progressMonitor, InstallerOperation operation) { foreach (var installerHandle in installerHandles) { if (progressMonitor.IsCanceled) return false; IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1); if (elevationContext != null && installerHandle.GetTraits().RequiresElevation) { elevationContext.Execute(InstallerElevatedCommand.ElevatedCommandId, new InstallerElevatedCommand.Arguments(installerHandle.Id, operation), subProgressMonitor); } else { IInstaller installer = installerHandle.GetComponent(); if (operation == InstallerOperation.Install) installer.Install(progressMonitor.CreateSubProgressMonitor(1)); else installer.Uninstall(progressMonitor.CreateSubProgressMonitor(1)); } } return true; }
public override void ApplyPendingSettingsChanges(IElevationContext elevationContext, IProgressMonitor progressMonitor) { elevationContext.Execute(CommitterId, configuration, progressMonitor); PendingSettingsChanges = false; }
public override void ApplyPendingSettingsChanges(IElevationContext elevationContext, IProgressMonitor progressMonitor) { elevationContext.Execute(CommitterId, configuration, progressMonitor); PendingSettingsChanges = false; }