/// <summary> /// The run app. /// </summary> private static void RunApp() { try { // Application Services ApplicationRestartRecoveryManager.RegisterForApplicationRestart( new RestartSettings(string.Empty, RestartRestrictions.None)); } catch (Exception) { } try { Notify = new NotifyIcon { Visible = false }; defualtApp.InitializeComponent(); defualtApp.DispatcherUnhandledException += (s, e) => { VDialog.Show( e.Exception.Message + "\r\n\r\n" + e.Exception.StackTrace, "FATAL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Handled = false; End(); }; defualtApp.Run(); } catch (Exception) { } End(); }
private void RegisterForRestart() { var settings = new RestartSettings("/restart", RestartRestrictions.None); ApplicationRestartRecoveryManager.RegisterForApplicationRestart(settings); AppLogger.Log.Info("Restart Registered"); }
public void WireUp() { TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException; AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; Application.Current.DispatcherUnhandledException += ApplicationOnDispatcherUnhandledException; ApplicationRestartRecoveryManager.RegisterForApplicationRestart(new RestartSettings("-died", RestartRestrictions.None)); }
private void RegisterForRestart() { // Register for automatic restart if the // application was terminated for any reason // other than a system reboot or a system update. ApplicationRestartRecoveryManager.RegisterForApplicationRestart( new RestartSettings("/restart", RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch)); Debug.WriteLine("ARR: Registered for restart"); }
private void RegisterForRestart() { var settings = new RestartSettings(string.Format("/restart:{0}", _tempPath), RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch); ApplicationRestartRecoveryManager.RegisterForApplicationRestart(settings); TraceTextBlock.Text += string.Format("{0:T}: Registered for restart\n", DateTime.Now); App.Source.TraceEvent(TraceEventType.Verbose, 0, "Registered for restart"); // NOTE: Зарегистрировано для перезапуска }
/// <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)); }
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); } }
/// <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 RegisterARR() { ApplicationRestartRecoveryManager.RegisterForApplicationRestart(new RestartSettings(string.Empty, RestartRestrictions.None)); ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(new RecoverySettings(new RecoveryData(PerformRecovery, null), 5000)); }