/// <summary> /// Registers an application for 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 (see remarks).</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 indicates the time within /// which the recovery callback method /// calls the <see cref="Microsoft.SDK.Samples.VistaBridge.Library.AppRecoveryRestart.ArrManager.ApplicationRecoveryInProgress"/> method to indicate /// that it is still performing recovery work.</remarks> public static void RegisterForApplicationRecovery( RecoverySettings settings) { RegisterForApplicationRecovery( settings.RecoveryCallback, settings.ParameterValue, settings.PingInterval); }
/// <summary> /// Returns the current settings for application recovery. /// </summary> /// <param name="processHandle">A handle to the application's /// process.</param> /// <returns>A <see cref="Microsoft.SDK.Samples.VistaBridge.Library.AppRecoveryRestart.RecoverySettings"/> object that specifies /// the callback method, an optional parameter to pass /// to the callback method and the time interval /// within which the callback method /// calls the <see cref="Microsoft.SDK.Samples.VistaBridge.Library.AppRecoveryRestart.ArrManager.ApplicationRecoveryInProgress"/> method to indicate /// that it is still performing recovery work.</returns> /// <exception cref="System.ArgumentException">Cannot get the settings due to an invalid parameter.</exception> /// <exception cref="System.InvalidOperationException">The application is not registered for recovery.</exception> public static RecoverySettings ApplicationRecoverySettings( IntPtr processHandle) { RecoveryData parameter = null; RecoveryCallback recoveryCallback; uint pingInterval; ApplicationRecoverySettings( processHandle, out recoveryCallback, out parameter, out pingInterval); RecoverySettings settings = new RecoverySettings( recoveryCallback, parameter, pingInterval); return(settings); }
/// <summary> /// Returns the current settings for application recovery. /// </summary> /// <param name="processHandle">A handle to the application's /// process.</param> /// <returns>A <see cref="Microsoft.SDK.Samples.VistaBridge.Library.AppRecoveryRestart.RecoverySettings"/> object that specifies /// the callback method, an optional parameter to pass /// to the callback method and the time interval /// within which the callback method /// calls the <see cref="Microsoft.SDK.Samples.VistaBridge.Library.AppRecoveryRestart.ArrManager.ApplicationRecoveryInProgress"/> method to indicate /// that it is still performing recovery work.</returns> /// <exception cref="System.ArgumentException">Cannot get the settings due to an invalid parameter.</exception> /// <exception cref="System.InvalidOperationException">The application is not registered for recovery.</exception> public static RecoverySettings ApplicationRecoverySettings( IntPtr processHandle) { RecoveryData parameter = null; RecoveryCallback recoveryCallback; uint pingInterval; ApplicationRecoverySettings( processHandle, out recoveryCallback, out parameter, out pingInterval); RecoverySettings settings = new RecoverySettings( recoveryCallback, parameter, pingInterval); return settings; }
private static void RegisterForRecovery() { RecoverySettings settings = new RecoverySettings( new RecoveryCallback(RecoveryProcedure), new RecoveryData(Environment.UserName), 4000); ArrManager.RegisterForApplicationRecovery( settings); }