private void RegisterRecovery() { var settings = new RecoverySettings(new RecoveryData(SaveState, AppConfigs.Configuration), 0); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings); AppLogger.Log.Info("Recovery Registered"); }
private static void DisplayRecoverySettings() { RecoverySettings settings = ArrManager.ApplicationRecoverySettings( Process.GetCurrentProcess().Handle); Console.WriteLine(settings.ToString()); Console.WriteLine(); }
private void RegisterForRecovery() { var settings = new RecoverySettings(new RecoveryData(DoRecovery, _tempPath), 0); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings); TraceTextBlock.Text += string.Format("{0:T}: Registered for recovery\n", DateTime.Now); App.Source.TraceEvent(TraceEventType.Verbose, 0, "Registered for recovery"); // NOTE: Зарегистрировано для восстановления }
private static void RegisterForRecovery() { RecoverySettings settings = new RecoverySettings( new RecoveryCallback(RecoveryProcedure), new RecoveryData(Environment.UserName), 4000); ArrManager.RegisterForApplicationRecovery( settings); }
private void RegisterApplicationRecoveryAndRestart() { if (CoreHelpers.RunningOnVista) { // register for Application Restart and Recovery RestartSettings restartSettings = new RestartSettings(string.Empty, RestartRestrictions.None); ApplicationRestartRecoveryManager.RegisterForApplicationRestart(restartSettings); RecoverySettings recoverySettings = new RecoverySettings(new RecoveryData(PerformRecovery, null), c_keepAliveInterval); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(recoverySettings); } }
private void RegisterForRecovery() { // Don't pass any state. We'll use our static variable "CurrentFile" to determine // the current state of the application. // Since this registration is being done on application startup, we don't have a state currently. // In some cases it might make sense to pass this initial state. // Another approach: When doing "auto-save", register for recovery everytime, and pass // the current state at that time. RecoveryData data = new RecoveryData(new RecoveryCallback(RecoveryProcedure), null); RecoverySettings settings = new RecoverySettings(data, 0); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings); Debug.WriteLine("ARR: Registered for recovery"); }
/// <summary>Registers the application to use the Recovery Manager.</summary> static void RegisterApplicationRecoveryAndRestart() { if (Environment.OSVersion.Version.Major < 6) { return; } // register for Application Restart ApplicationRestartRecoveryManager.RegisterForApplicationRestart( new RestartSettings(string.Empty, RestartRestrictions.NotOnReboot)); // register for Application Recovery var recoverySettings = new RecoverySettings(new RecoveryData(PerformRecovery, null), 4000); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(recoverySettings); }
public Form1() { InitializeComponent(); recoveryFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "RecoveryData.xml"); ApplicationRestartRecoveryManager.RegisterForApplicationRestart( new RestartSettings("/restart", RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch)); var data = new RecoveryData(RecoveryProcedure, null); var settings = new RecoverySettings(data, 0); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings); if (Environment.GetCommandLineArgs().Length > 1 && Environment.GetCommandLineArgs()[1] == "/restart") { RecoverLastSession(Environment.GetCommandLineArgs()[1]); } }
public MainWindow() { InitializeComponent(); //Register next Restart Recovery key (It ensures that application if application closes other than OnPatch/ OnReboot / NormalEnd // it pass the /recovery argument. ApplicationRestartRecoveryManager.RegisterForApplicationRestart( new RestartSettings("/recover", RestartRestrictions.NotOnPatch | RestartRestrictions.NotOnReboot)); //Register Recovery data. var data = new RecoveryData(RecoverDataCallback, null); var seting = new RecoverySettings(data, 0); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(seting); // Lets Check wheher recovery needed var args = Environment.GetCommandLineArgs(); if (args.Length > 1 && args[1].Equals("/recovery", StringComparison.InvariantCultureIgnoreCase)) { StartRecovery("/recovery"); } SaveButton.IsEnabled = false; }
private void RegisterApplicationRecoveryAndRestart() { RecoverySettings recoverySettings = new RecoverySettings(new RecoveryData(PerformRecovery, null), 5000); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(recoverySettings); }