C# Class WebApplications.Utilities.Service.BaseService

Inheritance: System.ServiceProcess.ServiceBase
Show file Open project: webappsuk/CoreLibraries Class Usage Examples

Public Properties

Property Type Description
IsService bool

Public Methods

Method Description
Connect ( [ connection ) : System.Guid

Connects the specified connection.

Disconnect ( System.Guid id ) : bool

Disconnects the specified user interface.

Run ( RunMode runMode = RunMode.Default ) : void

Runs the service, either as a service or as a console application.

Protected Methods

Method Description
BaseService ( [ name, [ displayName, [ description, [ serverConfiguration = null ) : System

Initializes a new instance of the BaseService class.

DoContinue ( ) : void

When implemented in a derived class, M:System.ServiceProcess.ServiceBase.OnContinue runs when a Continue command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service resumes normal functioning after being paused.

DoCustomCommand ( int command ) : void

When implemented in a derived class, M:System.ServiceProcess.ServiceBase.OnCustomCommand(System.Int32) executes when the Service Control Manager (SCM) passes a custom command to the service. Specifies actions to take when a command with the specified parameter value occurs.

DoPause ( ) : void

When implemented in a derived class, executes when a Pause command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service pauses.

DoPowerEvent ( PowerBroadcastStatus powerStatus ) : bool

When implemented in a derived class, executes when the computer's power status has changed. This applies to laptop computers when they go into suspended mode, which is not the same as a system shutdown.

DoSessionChange ( System.ServiceProcess.SessionChangeDescription changeDescription ) : void

Executes when a change event is received from a Terminal Server session.

DoShutdown ( ) : void

When implemented in a derived class, executes when the system is shutting down. Specifies what should occur immediately prior to the system shutting down.

DoStart ( [ args ) : void
DoStop ( ) : void

When implemented in a derived class, executes when a Stop command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service stops running.

Private Methods

Method Description
BaseService ( ) : System

Initializes static members of the BaseService class.

Continue ( [ writer, CancellationToken token = default(CancellationToken) ) : Task
CustomCommand ( [ writer, [ command, CancellationToken token = default(CancellationToken) ) : Task
ExecuteAsync ( System.Guid id, [ commandLine, [ writer, CancellationToken token = default(CancellationToken) ) : Task
Help ( [ writer, [ command = null, [ parameter = null ) : void
Install ( [ writer, [ userName = null, [ password = null ) : void
Pause ( [ writer, CancellationToken token = default(CancellationToken) ) : Task
Performance ( [ writer, [ category = null ) : void
PowerEvent ( [ writer, [ powerStatus ) : bool
RunAsync ( RunMode runMode = RunMode.Default, CancellationToken token = default(CancellationToken) ) : Task
SessionChange ( [ writer, [ changeReason, [ sessionId ) : void
Shutdown ( [ writer ) : bool
StartService ( [ writer, [ args, CancellationToken token = default(CancellationToken) ) : Task
StopService ( [ writer, CancellationToken token = default(CancellationToken) ) : Task
Uninstall ( [ writer, CancellationToken token = default(CancellationToken) ) : Task

Method Details

BaseService() protected method

Initializes a new instance of the BaseService class.
protected BaseService ( [ name, [ displayName, [ description, [ serverConfiguration = null ) : System
name [ The name.
displayName [ The display name.
description [ The description.
serverConfiguration [ The server configuration.
return System

Connect() public abstract method

Connects the specified connection.
public abstract Connect ( [ connection ) : System.Guid
connection [ The connection.
return System.Guid

Disconnect() public abstract method

Disconnects the specified user interface.
public abstract Disconnect ( System.Guid id ) : bool
id System.Guid The connection.
return bool

DoContinue() protected method

When implemented in a derived class, M:System.ServiceProcess.ServiceBase.OnContinue runs when a Continue command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service resumes normal functioning after being paused.
protected DoContinue ( ) : void
return void

DoCustomCommand() protected method

When implemented in a derived class, M:System.ServiceProcess.ServiceBase.OnCustomCommand(System.Int32) executes when the Service Control Manager (SCM) passes a custom command to the service. Specifies actions to take when a command with the specified parameter value occurs.
protected DoCustomCommand ( int command ) : void
command int The command message sent to the service.
return void

DoPause() protected method

When implemented in a derived class, executes when a Pause command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service pauses.
protected DoPause ( ) : void
return void

DoPowerEvent() protected method

When implemented in a derived class, executes when the computer's power status has changed. This applies to laptop computers when they go into suspended mode, which is not the same as a system shutdown.
protected DoPowerEvent ( PowerBroadcastStatus powerStatus ) : bool
powerStatus PowerBroadcastStatus A that indicates a notification from the system about its power status.
return bool

DoSessionChange() protected method

Executes when a change event is received from a Terminal Server session.
protected DoSessionChange ( System.ServiceProcess.SessionChangeDescription changeDescription ) : void
changeDescription System.ServiceProcess.SessionChangeDescription A structure that identifies the change type.
return void

DoShutdown() protected method

When implemented in a derived class, executes when the system is shutting down. Specifies what should occur immediately prior to the system shutting down.
protected DoShutdown ( ) : void
return void

DoStart() protected method

protected DoStart ( [ args ) : void
args [
return void

DoStop() protected method

When implemented in a derived class, executes when a Stop command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service stops running.
protected DoStop ( ) : void
return void

Run() public method

Runs the service, either as a service or as a console application.
public Run ( RunMode runMode = RunMode.Default ) : void
runMode RunMode The run mode.
return void

Property Details

IsService public property

Whether the service is running as a service.
public bool IsService
return bool