ClassRadService
Represents an abstract base class that provides service capabilities for Telerik WinControls.
Definition
Namespace:Telerik.WinControls
Assembly:Telerik.WinControls.dll
Syntax:
public abstract class RadService : RadObject, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor
Inheritance: objectDisposableObjectRadObjectRadService
Derived Classes:
Implements:
Inherited Members
Constructors
RadService()
Initializes a new instance of the RadService class.
Declaration
protected RadService()
Remarks
Sets the initial state to Initial and enables the service by default.
Properties
AvailableAtDesignTime
Determines whether the service is available at design-time. False by default.
Declaration
public virtual bool AvailableAtDesignTime { get; }
Property Value
Context
Gets the context associated with the current operation. This member is valid only while the Service is started or paused.
Enabled
Determines whether the Service is enabled (may be started). If the Service is working and its is disabled, it will end its current operation.
Name
Gets the name of the service.
State
Gets the current state of the service.
Methods
Abort()
Aborts the current operation without applying any changes.
Declaration
protected virtual void Abort()
CanOperate()
Determines whether the service is operational and may perform actions.
CanStart(object)
Determines whether the service may be started. Validation is as follows:
- Check whether Enabled is true.
- Check the context through IsContextValid method. An exception is thrown if context is invalid.
- Checks the current state - it should be Initial or Stopped.
Commit()
Ends the current operation and applies all changes.
Declaration
protected virtual void Commit()
IsContextValid(object)
Evaluates the provided context. Some services may not operate without certain context provided.
OnEnabledChanged()
Notifies for a change in the Enabled state.
Declaration
protected virtual void OnEnabledChanged()
OnStarted()
Notifies that the service has been successfully started. Allows inheritors to perform some additional logic upon start.
Declaration
protected virtual void OnStarted()
OnStarting(RadServiceStartingEventArgs)
Notifies that a start request has occured. Cancelable.
Declaration
protected virtual void OnStarting(RadServiceStartingEventArgs e)
Parameters
e
OnStopped()
Notifies that a running operation has stopped. Allows inheritors to perform some additional logic upon stop.
Declaration
protected virtual void OnStopped()
OnStopping(RadServiceStoppingEventArgs)
Notifies that a stop request has occured. Cancelable.
Declaration
protected virtual void OnStopping(RadServiceStoppingEventArgs e)
Parameters
e
PerformPause()
Performs the core Pause logic.
Declaration
protected virtual void PerformPause()
PerformResume()
Performs the core Resume logic.
Declaration
protected virtual void PerformResume()
PerformStart()
Performs the core Start logic.
Declaration
protected virtual void PerformStart()
PerformStop()
Stops the service. Performs the core logic.
Declaration
protected virtual void PerformStop()
SetContext(object)
Sets the provided object as the current context.
Declaration
protected virtual void SetContext(object context)
Parameters
context
Start(object)
Starts the Service. If the service was previously paused, it should be re-started with the Resume method.
Declaration
public void Start(object context)
Parameters
context
A context passed to the service.
Stop(bool)
Stops currently working or previously stopped service.
Declaration
public void Stop(bool commit)
Parameters
commit
True to indicate that current operation ended successfully, false otherwise.
Events
Started
Raised right after the service is started.
Starting
Raised when the service is about to be started.
Declaration
public event EventHandler<RadServiceStartingEventArgs> Starting
Event Value
Stopped
Raised when the service is stopped.
Stopping
Raised when the service is about to be stopped.
Declaration
public event EventHandler<RadServiceStoppingEventArgs> Stopping
Event Value