packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs
/// <summary>
/// Registers an application for automatic restart if 
/// the application 
/// is terminated by Windows Error Reporting.
/// </summary>
/// <param name="settings">An object that specifies
/// the command line arguments used to restart the 
/// application, and 
/// the conditions under which the application should not be 
/// restarted.</param>
/// <exception cref="System.ArgumentException">Registration failed due to an invalid parameter.</exception>
/// <exception cref="System.InvalidOperationException">The attempt to register failed.</exception>
/// <remarks>A registered application will not be restarted if it executed for less than 60 seconds before terminating.</remarks>
Registers an application for automatic restart if
the application
is terminated by Windows Error Reporting.
Registers an application for automatic restart if the application is terminated by Windows Error Reporting .
public static void RegisterForApplicationRestart(RestartSettings settings)
        {
            CoreHelpers.ThrowIfNotVista();
            if (settings == null) { throw new ArgumentNullException("settings"); }
            HResult hr = AppRestartRecoveryNativeMethods.RegisterApplicationRestart(settings.Command, settings.Restrictions);
            if (hr == HResult.Fail)
            {
                throw new InvalidOperationException(LocalizedMessages.ApplicationRecoveryFailedToRegisterForRestart);
            }
            else if (hr == HResult.InvalidArguments)
            {
                throw new ArgumentException(LocalizedMessages.ApplicationRecoverFailedToRegisterForRestartBadParameters);
            }
        }
public static void RegisterForApplicationRestart ( RestartSettings settings ) { CoreHelpers . ThrowIfNotVista ( ) ; if ( settings == null ) { throw new ArgumentNullException ( " " ) ; } HResult hr = AppRestartRecoveryNativeMethods . RegisterApplicationRestart ( settings . Command , settings . Restrictions ) ; if ( hr == HResult . Fail ) { throw new InvalidOperationException ( LocalizedMessages . ApplicationRecoveryFailedToRegisterForRestart ) ; } else if ( hr == HResult . InvalidArguments ) { throw new ArgumentException ( LocalizedMessages . ApplicationRecoverFailedToRegisterForRestartBadParameters ) ; } }
Registers an application for automatic restart if
the application
is terminated by Windows Error Reporting.
Registers an application for automatic restart if the application is terminated by Windows Error Reporting .
// Throw PlatformNotSupportedException if the user is not running Vista or beyond
Registration failed due to an invalid parameter.
Registration failed due to an invalid parameter .
The attempt to register failed.
The attempt to register failed .
settings
RestartSettings
An object that specifies
the command line arguments used to restart the
application, and
the conditions under which the application should not be
restarted.
An object that specifies the command line arguments used to restart the application and the conditions under which the application should not be restarted .
remarks
A registered application will not be restarted if it executed for less than 60 seconds before terminating.
A registered application will not be restarted if it executed for less than 60 seconds before terminating .