/// <summary>
 /// Unregister the application before it exits.
 /// </summary>
 public static void Unregister()
 {
     ApplicationRecoveryAndRestartNativeMethods.UnregisterApplicationRestart();
 }
 /// <summary>
 /// Register the application to restart in all failure cases.
 /// The application is run with the specified arguments.
 /// </summary>
 public static void Register()
 {
     ApplicationRecoveryAndRestartNativeMethods.RegisterApplicationRestart(commandLineArgs: RestartSwitch, ApplicationRecoveryAndRestartNativeMethods.RestartRestrictions.None);
 }