packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs
/// <summary>
/// Registers an application for recovery by Application Restart and Recovery.
/// </summary>
/// <param name="settings">An object that specifies
/// the callback method, an optional parameter to pass to the callback
/// method and a time interval.</param>
/// <exception cref="System.ArgumentException">
/// The registration failed due to an invalid parameter.
/// </exception>
/// <exception cref="System.ComponentModel.Win32Exception">
/// The registration failed.</exception>
/// <remarks>The time interval is the period of time within 
/// which the recovery callback method 
/// calls the <see cref="ApplicationRecoveryInProgress"/> method to indicate
/// that it is still performing recovery work.</remarks>        
Registers an application for recovery by Application Restart and Recovery.
Registers an application for recovery by Application Restart and Recovery .
public static void RegisterForApplicationRecovery(RecoverySettings settings)
        {           
            CoreHelpers.ThrowIfNotVista();
            if (settings == null) { throw new ArgumentNullException("settings"); }
            GCHandle handle = GCHandle.Alloc(settings.RecoveryData);
            HResult hr = AppRestartRecoveryNativeMethods.RegisterApplicationRecoveryCallback(
                AppRestartRecoveryNativeMethods.InternalCallback, (IntPtr)handle, settings.PingInterval, (uint)0);
            if (!CoreErrorHelper.Succeeded(hr))
            {
                if (hr == HResult.InvalidArguments)
                {
                    throw new ArgumentException(LocalizedMessages.ApplicationRecoveryBadParameters, "settings");
                }
                throw new ApplicationRecoveryException(LocalizedMessages.ApplicationRecoveryFailedToRegister);
            }
        }
public static void RegisterForApplicationRecovery ( RecoverySettings settings ) { CoreHelpers . ThrowIfNotVista ( ) ; if ( settings == null ) { throw new ArgumentNullException ( " " ) ; } GCHandle handle = GCHandle . Alloc ( settings . RecoveryData ) ; HResult hr = AppRestartRecoveryNativeMethods . RegisterApplicationRecoveryCallback ( AppRestartRecoveryNativeMethods . InternalCallback , ( IntPtr ) handle , settings . PingInterval , ( uint ) 0 ) ; if ( ! CoreErrorHelper . Succeeded ( hr ) ) { if ( hr == HResult . InvalidArguments ) { throw new ArgumentException ( LocalizedMessages . ApplicationRecoveryBadParameters , " " ) ; } throw new ApplicationRecoveryException ( LocalizedMessages . ApplicationRecoveryFailedToRegister ) ; } }
Registers an application for recovery by Application Restart and Recovery.
Registers an application for recovery by Application Restart and Recovery .
The registration failed due to an invalid parameter.
The registration failed due to an invalid parameter .
The registration failed.
The registration failed .
settings
RecoverySettings
An object that specifies
the callback method, an optional parameter to pass to the callback
method and a time interval.
An object that specifies the callback method an optional parameter to pass to the callback method and a time interval .
remarks
The time interval is the period of time within
which the recovery callback method
calls the
method to indicate
that it is still performing recovery work.
The time interval is the period of time within which the recovery callback method calls the method to indicate that it is still performing recovery work .