New to Telerik UI for WinFormsStart a free 30-day trial

Represents a service that is state-based. E.g. it may start, perform some action and stop.

Definition

Constructors

Default constructor.

C#
public StateService()

Properties

Determines whether the service is available at design-time. False by default.

C#
public virtual bool AvailableAtDesignTime { get; }

Gets the context associated with the current operation. This member is valid only while the Service is started or paused.

C#
public object Context { get; }

Gets the current state of the service.

C#
public ServiceState State { get; }

Methods

Aborts the current operation without applying any changes.

C#
protected virtual void Abort()

Determines whether the service may be started. Validation is as follows:

  1. Check whether Enabled is true.
  2. Check the context through IsContextValid method. An exception is thrown if context is invalid.
  3. Checks the current state - it should be Initial or Stopped.
C#
protected virtual bool CanStart(object context)
Parameters:contextobjectReturns:

bool

Ends the current operation and applies all changes.

C#
protected virtual void Commit()

Evaluates the provided context. Some services may not operate without certain context provided.

C#
protected virtual bool IsContextValid(object context)
Parameters:contextobjectReturns:

bool

Provides additional processing when a change in the owning RadDock instance occurs.

C#
protected override void OnDockManagerChanged()

Overrides: RadDockService.OnDockManagerChanged()

Provides additional processing for a change in the Enabled state.

C#
protected override void OnEnabledChanged()

Overrides: RadDockService.OnEnabledChanged()

Notifies that the service has been successfully started. Allows inheritors to perform some additional logic upon start.

C#
protected virtual void OnStarted()

Notifies that a start request has occured. Cancelable.

C#
protected virtual void OnStarting(StateServiceStartingEventArgs e)
Parameters:eStateServiceStartingEventArgs

Notifies that a running operation has stopped. Allows inheritors to perform some additional logic upon stop.

C#
protected virtual void OnStopped()

Notifies that a stop request has occured. Cancelable.

C#
protected virtual void OnStopping(StateServiceStoppingEventArgs e)
Parameters:eStateServiceStoppingEventArgs

Pauses a currently running operation.

C#
public void Pause()

Performs the core Pause logic.

C#
protected virtual void PerformPause()

Performs the core Resume logic.

C#
protected virtual void PerformResume()

Performs the core Start logic.

C#
protected virtual void PerformStart()

Stops the service. Performs the core logic.

C#
protected virtual void PerformStop()

Resumes previously paused operation.

C#
public void Resume()

Sets the provided object as the current context.

C#
protected virtual void SetContext(object context)
Parameters:contextobject

Starts the Service. If the service was previously paused, it should be re-started with the Resume method.

C#
public void Start(object context)
Parameters:contextobject

Stops currently working or previously stopped service.

C#
public void Stop(bool commit)
Parameters:commitbool

True to indicate that current operation ended successfully, false otherwise.

Events

Raised right after the service is started.

C#
public event EventHandler Started

Raised when the service is about to be started.

C#
public event StateServiceStartingEventHandler Starting

Raised when the service is stopped.

C#
public event EventHandler Stopped

Raised when the service is about to be stopped.

C#
public event StateServiceStoppingEventHandler Stopping