GetConfigurationSetDetailsProgressOutput.cs (2537B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="GetConfigurationSetDetailsProgressOutput.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGet.Configuration.Engine.Helpers 8 { 9 using Microsoft.Management.Configuration; 10 using Microsoft.WinGet.Common.Command; 11 using Windows.Foundation; 12 13 /// <summary> 14 /// Helper to handle progress callback from GetSetDetailsAsync. 15 /// </summary> 16 internal class GetConfigurationSetDetailsProgressOutput : ConfigurationSetProgressOutputBase<GetConfigurationSetDetailsResult, GetConfigurationUnitDetailsResult> 17 { 18 /// <summary> 19 /// Initializes a new instance of the <see cref="GetConfigurationSetDetailsProgressOutput"/> class. 20 /// </summary> 21 /// <param name="cmd">Command that outputs the messages.</param> 22 /// <param name="activityId">The activity id of the progress bar.</param> 23 /// <param name="activity">The activity.</param> 24 /// <param name="inProgressMessage">The message in the progress bar.</param> 25 /// <param name="completeMessage">The activity complete message.</param> 26 /// <param name="totalUnitsExpected">Total of units expected.</param> 27 public GetConfigurationSetDetailsProgressOutput(PowerShellCmdlet cmd, int activityId, string activity, string inProgressMessage, string completeMessage, int totalUnitsExpected) 28 : base(cmd, activityId, activity, inProgressMessage, completeMessage, totalUnitsExpected) 29 { 30 } 31 32 /// <summary> 33 /// Gets the units shown. 34 /// </summary> 35 public int UnitsShown 36 { 37 get { return this.UnitsCompleted.Count; } 38 } 39 40 /// <inheritdoc/> 41 public override void Progress(IAsyncOperationWithProgress<GetConfigurationSetDetailsResult, GetConfigurationUnitDetailsResult> operation, GetConfigurationUnitDetailsResult result) 42 { 43 this.HandleProgress(operation.GetResults()); 44 } 45 46 /// <inheritdoc/> 47 public override void HandleProgress(GetConfigurationSetDetailsResult result) 48 { 49 foreach (var unitResult in result.UnitResults) 50 { 51 this.CompleteUnit(unitResult.Unit); 52 } 53 } 54 } 55 }