Show / Hide Table of Contents

Class WindowsRestartManager

Provides an interface to the Windows Restart Manager. Supported on Windows Vista or newer.

Inheritance
Object
WindowsRestartManager
Namespace: NanoByte.Common.Native
Assembly: NanoByte.Common.dll
Syntax
public sealed class WindowsRestartManager : MarshalByRefObject
Remarks

See https://msdn.microsoft.com/en-us/library/windows/desktop/cc948910

Constructors

WindowsRestartManager()

Starts a new Restart Manager session.

Declaration
public WindowsRestartManager()
Exceptions
Type Condition
Win32Exception

The Restart Manager API returned an error.

PlatformNotSupportedException

The current platform does not support the Restart Manager. Needs Windows Vista or newer.

Methods

Dispose()

Ends the Restart Manager session.

Declaration
public void Dispose()

Finalize()

Declaration
protected override void Finalize()

ListApps(CancellationToken)

Gets a list of all applications that are currently using resources that have been registered with RegisterResources(String[]).

Declaration
public string[] ListApps(CancellationToken cancellationToken = null)
Parameters
Type Name Description
CancellationToken cancellationToken

Used to signal cancellation requests.

Returns
Type Description
String[]
Exceptions
Type Condition
IOException

The Restart Manager could not access the registry.

TimeoutException

The Restart Manager could not obtain a Registry write mutex in the allotted time. A system restart is recommended.

Win32Exception

The Restart Manager API returned an error.

RegisterResources(String[])

Registers resources to the Restart Manager session. The Restart Manager uses the list of resources registered with the session to determine which applications and services must be shut down and restarted.

Declaration
public void RegisterResources(params string[] files)
Parameters
Type Name Description
String[] files

An array of full filename paths.

Exceptions
Type Condition
Win32Exception

The Restart Manager API returned an error.

RestartApps(ITaskHandler)

Restarts applications that have been shut down by ShutdownApps(ITaskHandler) and that have been registered to be restarted.

Declaration
public void RestartApps(ITaskHandler handler)
Parameters
Type Name Description
ITaskHandler handler

A callback object used to report progress to the user and allow cancellation.

Exceptions
Type Condition
IOException

One or more applications could not be automatically restarted.

Win32Exception

The Restart Manager API returned an error.

ShutdownApps(ITaskHandler)

Initiates the shutdown of applications that are currently using resources that have been registered with RegisterResources(String[]).

Declaration
public void ShutdownApps(ITaskHandler handler)
Parameters
Type Name Description
ITaskHandler handler

A callback object used to report progress to the user and allow cancellation.

Exceptions
Type Condition
UnauthorizedAccessException

One or more applications could not be shut down. Trying again as administrator may help.

IOException

One or more applications could not be shut down. A system reboot may be required.

Win32Exception

The Restart Manager API returned an error.

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)
In This Article
Back to top Copyright Bastian Eicher