public async Task HandleUpdates(UpdatePromptingModes confirmationMode, IReadOnlyList <UpdatePackageData> packagesToInstall, UpdatePackageData updaterUpdate) { try { if (packagesToInstall != null && packagesToInstall.Any()) { var shouldInstallNow = await this.DownloadUpdatesIfNeeded(confirmationMode, packagesToInstall, updaterUpdate).ConfigureAwait(false); if (!shouldInstallNow.Item1) { return; } FileInfo instructionsFile = UpdateInstructionCreator.CreateInstructionsFile(packagesToInstall, this.programInfo.Program, this.programInfo.Program.Name); foreach (UpdatePackageData item in packagesToInstall) { this.telemetryModule.Event(BuiltInEventKeys.UpdateInstallation, properties: new Dictionary <string, string>() { { "PackageVersion", item.Version }, { "FromVersionAssembly", this.programInfo.Program.PrimaryAssembly.VersionData.AssemblyVersion }, { "FromVersionFile", this.programInfo.Program.PrimaryAssembly.VersionData.FileVersion }, }); } this.telemetryModule.SendAllDataNow(); this.updateInstaller.InstallUpdates(instructionsFile, shouldInstallNow.Item2); } } catch (Exception ex) { throw new InvalidOperationException($"An error occured while handling updates", ex); } }
public async Task HandleUpdates(UpdatePromptingModes confirmationMode, IReadOnlyList <UpdatePackageData> packagesToInstall, UpdatePackageData updaterUpdate) { try { if (packagesToInstall != null && packagesToInstall.Any()) { var shouldInstallNow = await this.DownloadUpdatesIfNeeded(confirmationMode, packagesToInstall, updaterUpdate).ConfigureAwait(false); if (!shouldInstallNow.Item1) { return; } FileInfo instructionsFile = UpdateInstructionCreator.CreateInstructionsFile(packagesToInstall, this.programInfo.Program, this.programInfo.Program.Name); this.updateInstaller.InstallUpdates(instructionsFile, shouldInstallNow.Item2); } } catch (Exception ex) { throw new InvalidOperationException($"An error occured while handling updates", ex); } }