StopWinGetConfigurationCmdlet.cs (1539B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="StopWinGetConfigurationCmdlet.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGet.Configuration.Cmdlets 8 { 9 using System.Management.Automation; 10 using Microsoft.WinGet.Configuration.Engine.Commands; 11 using Microsoft.WinGet.Configuration.Engine.PSObjects; 12 13 /// <summary> 14 /// Stop-WinGetConfiguration. 15 /// Cancels a configuration previously started by Start-WinGetConfiguration. 16 /// </summary> 17 [Cmdlet(VerbsLifecycle.Stop, "WinGetConfiguration")] 18 [Alias("spwgc")] 19 public sealed class StopWinGetConfigurationCmdlet : PSCmdlet 20 { 21 /// <summary> 22 /// Gets or sets the configuration task. 23 /// </summary> 24 [Parameter( 25 Position = 0, 26 Mandatory = true, 27 ValueFromPipeline = true, 28 ValueFromPipelineByPropertyName = true)] 29 public PSConfigurationJob ConfigurationJob { get; set; } 30 31 /// <summary> 32 /// Starts to apply the configuration and wait for it to complete. 33 /// </summary> 34 protected override void ProcessRecord() 35 { 36 var configCommand = new ConfigurationCommand(this); 37 configCommand.Cancel(this.ConfigurationJob); 38 } 39 } 40 }