RadService
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
Initializes a new instance of the RadService class.
protected RadService()
Sets the initial state to Initial and enables the service by default.
Properties
Determines whether the service is available at design-time. False by default.
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.
public object Context { get; }
Determines whether the Service is enabled (may be started). If the Service is working and its is disabled, it will end its current operation.
public bool Enabled { get; set; }
Gets the current state of the service.
public RadServiceState State { get; }
Methods
Aborts the current operation without applying any changes.
protected virtual void Abort()
Determines whether the service is operational and may perform actions.
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.
Ends the current operation and applies all changes.
protected virtual void Commit()
Notifies for a change in the Enabled state.
protected virtual void OnEnabledChanged()
Notifies that the service has been successfully started. Allows inheritors to perform some additional logic upon start.
protected virtual void OnStarted()
Notifies that a start request has occured. Cancelable.
protected virtual void OnStarting(RadServiceStartingEventArgs e)
Notifies that a running operation has stopped. Allows inheritors to perform some additional logic upon stop.
protected virtual void OnStopped()
Notifies that a stop request has occured. Cancelable.
protected virtual void OnStopping(RadServiceStoppingEventArgs e)
Pauses a currently running operation.
public void Pause()
Performs the core Pause logic.
protected virtual void PerformPause()
Performs the core Resume logic.
protected virtual void PerformResume()
Performs the core Start logic.
protected virtual void PerformStart()
Stops the service. Performs the core logic.
protected virtual void PerformStop()
Resumes previously paused operation.
public void Resume()
Sets the provided object as the current context.
Starts the Service. If the service was previously paused, it should be re-started with the Resume method.
Stops currently working or previously stopped service.
public void Stop(bool commit)
True to indicate that current operation ended successfully, false otherwise.
Events
Raised right after the service is started.
public event EventHandler Started
Raised when the service is about to be started.
public event EventHandler<RadServiceStartingEventArgs> Starting
Raised when the service is stopped.
public event EventHandler Stopped
Raised when the service is about to be stopped.
public event EventHandler<RadServiceStoppingEventArgs> Stopping