diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-03 15:30:50 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-04 10:05:21 -0500 |
| commit | 29f7e00586412163a20e298fbf84505f8a917425 (patch) | |
| tree | 30257a3544f6982ded159443ebed0eb933f11a51 /src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | |
| parent | 41d2c12d60ee84cefc26ec99abb328701883c8f5 (diff) | |
| download | wix-29f7e00586412163a20e298fbf84505f8a917425.tar.gz wix-29f7e00586412163a20e298fbf84505f8a917425.tar.bz2 wix-29f7e00586412163a20e298fbf84505f8a917425.zip | |
Only block shutdown during Apply.
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs')
| -rw-r--r-- | src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs index 6738a4a6..bb34a33e 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
| @@ -22,15 +22,12 @@ namespace WixToolset.Mba.Core | |||
| 22 | /// </summary> | 22 | /// </summary> |
| 23 | protected readonly IEngine engine; | 23 | protected readonly IEngine engine; |
| 24 | 24 | ||
| 25 | private bool applying; | ||
| 26 | |||
| 27 | /// <summary> | 25 | /// <summary> |
| 28 | /// Creates a new instance of the <see cref="BootstrapperApplication"/> class. | 26 | /// Creates a new instance of the <see cref="BootstrapperApplication"/> class. |
| 29 | /// </summary> | 27 | /// </summary> |
| 30 | protected BootstrapperApplication(IEngine engine) | 28 | protected BootstrapperApplication(IEngine engine) |
| 31 | { | 29 | { |
| 32 | this.engine = engine; | 30 | this.engine = engine; |
| 33 | this.applying = false; | ||
| 34 | this.asyncExecution = true; | 31 | this.asyncExecution = true; |
| 35 | } | 32 | } |
| 36 | 33 | ||
| @@ -41,9 +38,6 @@ namespace WixToolset.Mba.Core | |||
| 41 | public event EventHandler<ShutdownEventArgs> Shutdown; | 38 | public event EventHandler<ShutdownEventArgs> Shutdown; |
| 42 | 39 | ||
| 43 | /// <inheritdoc/> | 40 | /// <inheritdoc/> |
| 44 | public event EventHandler<SystemShutdownEventArgs> SystemShutdown; | ||
| 45 | |||
| 46 | /// <inheritdoc/> | ||
| 47 | public event EventHandler<DetectBeginEventArgs> DetectBegin; | 41 | public event EventHandler<DetectBeginEventArgs> DetectBegin; |
| 48 | 42 | ||
| 49 | /// <inheritdoc/> | 43 | /// <inheritdoc/> |
| @@ -332,25 +326,6 @@ namespace WixToolset.Mba.Core | |||
| 332 | } | 326 | } |
| 333 | 327 | ||
| 334 | /// <summary> | 328 | /// <summary> |
| 335 | /// Called by the engine, raises the <see cref="SystemShutdown"/> event. | ||
| 336 | /// </summary> | ||
| 337 | /// <param name="args">Additional arguments for this event.</param> | ||
| 338 | protected virtual void OnSystemShutdown(SystemShutdownEventArgs args) | ||
| 339 | { | ||
| 340 | EventHandler<SystemShutdownEventArgs> handler = this.SystemShutdown; | ||
| 341 | if (null != handler) | ||
| 342 | { | ||
| 343 | handler(this, args); | ||
| 344 | } | ||
| 345 | else if (null != args) | ||
| 346 | { | ||
| 347 | // Allow requests to shut down when critical or not applying. | ||
| 348 | bool critical = EndSessionReasons.Critical == (EndSessionReasons.Critical & args.Reasons); | ||
| 349 | args.Cancel = !critical && this.applying; | ||
| 350 | } | ||
| 351 | } | ||
| 352 | |||
| 353 | /// <summary> | ||
| 354 | /// Called by the engine, raises the <see cref="DetectBegin"/> event. | 329 | /// Called by the engine, raises the <see cref="DetectBegin"/> event. |
| 355 | /// </summary> | 330 | /// </summary> |
| 356 | /// <param name="args">Additional arguments for this event.</param> | 331 | /// <param name="args">Additional arguments for this event.</param> |
| @@ -1433,15 +1408,6 @@ namespace WixToolset.Mba.Core | |||
| 1433 | return args.HResult; | 1408 | return args.HResult; |
| 1434 | } | 1409 | } |
| 1435 | 1410 | ||
| 1436 | int IBootstrapperApplication.OnSystemShutdown(EndSessionReasons dwEndSession, ref bool fCancel) | ||
| 1437 | { | ||
| 1438 | SystemShutdownEventArgs args = new SystemShutdownEventArgs(dwEndSession, fCancel); | ||
| 1439 | this.OnSystemShutdown(args); | ||
| 1440 | |||
| 1441 | fCancel = args.Cancel; | ||
| 1442 | return args.HResult; | ||
| 1443 | } | ||
| 1444 | |||
| 1445 | int IBootstrapperApplication.OnDetectBegin(bool fCached, RegistrationType registrationType, int cPackages, ref bool fCancel) | 1411 | int IBootstrapperApplication.OnDetectBegin(bool fCached, RegistrationType registrationType, int cPackages, ref bool fCancel) |
| 1446 | { | 1412 | { |
| 1447 | DetectBeginEventArgs args = new DetectBeginEventArgs(fCached, registrationType, cPackages, fCancel); | 1413 | DetectBeginEventArgs args = new DetectBeginEventArgs(fCached, registrationType, cPackages, fCancel); |
| @@ -1693,8 +1659,6 @@ namespace WixToolset.Mba.Core | |||
| 1693 | 1659 | ||
| 1694 | int IBootstrapperApplication.OnApplyBegin(int dwPhaseCount, ref bool fCancel) | 1660 | int IBootstrapperApplication.OnApplyBegin(int dwPhaseCount, ref bool fCancel) |
| 1695 | { | 1661 | { |
| 1696 | this.applying = true; | ||
| 1697 | |||
| 1698 | ApplyBeginEventArgs args = new ApplyBeginEventArgs(dwPhaseCount, fCancel); | 1662 | ApplyBeginEventArgs args = new ApplyBeginEventArgs(dwPhaseCount, fCancel); |
| 1699 | this.OnApplyBegin(args); | 1663 | this.OnApplyBegin(args); |
| 1700 | 1664 | ||
| @@ -1949,8 +1913,6 @@ namespace WixToolset.Mba.Core | |||
| 1949 | ApplyCompleteEventArgs args = new ApplyCompleteEventArgs(hrStatus, restart, recommendation, pAction); | 1913 | ApplyCompleteEventArgs args = new ApplyCompleteEventArgs(hrStatus, restart, recommendation, pAction); |
| 1950 | this.OnApplyComplete(args); | 1914 | this.OnApplyComplete(args); |
| 1951 | 1915 | ||
| 1952 | this.applying = false; | ||
| 1953 | |||
| 1954 | pAction = args.Action; | 1916 | pAction = args.Action; |
| 1955 | return args.HResult; | 1917 | return args.HResult; |
| 1956 | } | 1918 | } |
