/// <summary>
        /// Called by an application's <see cref="RecoveryCallback"/> method
        /// to indicate that it is still performing recovery work.
        /// </summary>
        /// <returns>A <see cref="System.Boolean"/> value indicating whether the user
        /// canceled the recovery.</returns>
        /// <exception cref="Microsoft.WindowsAPICodePack.ApplicationServices.ApplicationRecoveryException">
        /// This method must be called from a registered callback method.</exception>
        public static bool ApplicationRecoveryInProgress()
        {
            CoreHelpers.ThrowIfNotVista();

            bool    canceled = false;
            HResult hr       = AppRestartRecoveryNativeMethods.ApplicationRecoveryInProgress(out canceled);

            if (!CoreErrorHelper.Succeeded(hr))
            {
                throw new InvalidOperationException(LocalizedMessages.ApplicationRecoveryMustBeCalledFromCallback);
            }

            return(canceled);
        }
        /// <summary>
        /// Called by an application's <see cref="RecoveryCallback"/> method
        /// to indicate that it is still performing recovery work.
        /// </summary>
        /// <returns>A <see cref="System.Boolean"/> value indicating whether the user
        /// canceled the recovery.</returns>
        /// <exception cref="System.InvalidOperationException">
        /// This method must be called from a registered callback method.</exception>
        public static bool ApplicationRecoveryInProgress()
        {
            // Throw PlatformNotSupportedException if the user is not running Vista or beyond
            CoreHelpers.ThrowIfNotVista();

            bool canceled = false;

            HRESULT hr = AppRestartRecoveryNativeMethods.ApplicationRecoveryInProgress(out canceled);

            if (hr == HRESULT.E_FAIL)
            {
                throw new InvalidOperationException("This method must be called from the registered callback method.");
            }

            return(canceled);
        }