Click or drag to resize

ScheduleManager Class

Monitors multiple Schedule at an interval of one minute to check if they are due.
Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    System.ComponentModelComponent
      GSF.SchedulingScheduleManager

Namespace: GSF.Scheduling
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
View Source

The ScheduleManager type exposes the following members.

Constructors
 NameDescription
Public methodScheduleManager Initializes a new instance of the ScheduleManager class.
Public methodScheduleManager(IContainer) Initializes a new instance of the ScheduleManager class.
Top
Properties
 NameDescription
Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event.
(Inherited from Component)
Public propertyContainerGets the IContainer that contains the Component.
(Inherited from Component)
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode.
(Inherited from Component)
Public propertyEnabled Gets or sets a boolean value that indicates whether the ScheduleManager object is currently enabled.
Protected propertyEventsGets the list of event handlers that are attached to this Component.
(Inherited from Component)
Public propertyIsDisposed Gets a flag that indicates whether the object has been disposed.
Public propertyIsRunning Gets a boolean value that indicates whether the ScheduleManager is running.
Public propertyName Gets the unique identifier of the ScheduleManager object.
Public propertyPersistSettings Gets or sets a boolean value that indicates whether the settings of ScheduleManager object are to be saved to the config file.
Public propertySchedules Gets a list of all Schedule monitored by the ScheduleManager object.
Public propertySettingsCategory Gets or sets the category under which the settings of ScheduleManager object are to be saved to the config file if the PersistSettings property is set to true.
Public propertySiteGets or sets the ISite of the Component.
(Inherited from Component)
Public propertyStatus Gets the descriptive status of the ScheduleManager object.
Top
Methods
 NameDescription
Public methodAddSchedule(String, String) Attempts to add a new Schedule.
Public methodAddSchedule(String, String, Boolean) Attempts to add a new Schedule.
Public methodAddSchedule(String, String, String) Attempts to add a new Schedule.
Public methodAddSchedule(String, String, String, Boolean) Attempts to add a new Schedule.
Public methodBeginInit Performs necessary operations before the ScheduleManager object properties are initialized.
Public methodCheckAllSchedules Checks all of the Schedules to determine if they are due.
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject)
Public methodDisposeReleases all resources used by the Component.
(Inherited from Component)
Protected methodDispose(Boolean) Releases the unmanaged resources used by the ScheduleManager object and optionally releases the managed resources.
(Overrides ComponentDispose(Boolean))
Public methodEndInit Performs necessary operations after the ScheduleManager object properties are initialized.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.
(Inherited from Component)
Public methodFindSchedule Searches for the Schedule with the specified name.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container.
(Inherited from Component)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodInitialize Initializes the ScheduleManager object.
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Public methodLoadSettings Loads saved settings for the ScheduleManager object from the config file if the PersistSettings property is set to true.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject)
Protected methodOnScheduleDue Raises the ScheduleDue event.
Protected methodOnScheduleDueCheck Raises the ScheduleDueCheck event.
Protected methodOnStarted Raises the Started event.
Protected methodOnStarting Raises the Starting event.
Public methodRemoveSchedule Attempts to remove a Schedule with the specified name if one exists.
Public methodSaveSettings Saves settings for the ScheduleManager object to the config file if the PersistSettings property is set to true.
Public methodStart Starts the ScheduleManager asynchronously if not running.
Public methodStop Stops the ScheduleManager if running.
Public methodToStringReturns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component)
Top
Events
 NameDescription
Public eventDisposedOccurs when the component is disposed by a call to the Dispose method.
(Inherited from Component)
Public eventScheduleDue Occurs asynchronously when a Schedule is due according to the rule specified for it.
Public eventScheduleDueCheck Occurs when the a particular Schedule is being checked to see if it is due.
Public eventStarted Occurs when the ScheduleManager has started at the top of the minute.
Public eventStarting Occurs while the ScheduleManager is waiting to start at the top of the minute.
Top
Fields
 NameDescription
Public fieldStatic memberDefaultPersistSettings Specifies the default value for the PersistSettings property.
Public fieldStatic memberDefaultSettingsCategory Specifies the default value for the SettingsCategory property.
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Example
This example shows how to use the ScheduleManager component:
C#
using System;
using GSF;
using GSF.Scheduling;

class Program
{
    static void Main(string[] args)
    {
        ScheduleManager scheduler = new ScheduleManager();
        scheduler.Initialize();
        // Add event handlers.
        scheduler.Starting += scheduler_Starting;
        scheduler.Started += scheduler_Started;
        scheduler.ScheduleDue += scheduler_ScheduleDue;
        // Add test schedules.
        scheduler.AddSchedule("Run.Notepad", "* * * * *");
        scheduler.AddSchedule("Run.Explorer", "* * * * *");
        // Start the scheduler.
        scheduler.Start();

        Console.ReadLine();
    }

    static void scheduler_Started(object sender, EventArgs e)
    {
        Console.WriteLine("Scheduler has started successfully.");
    }

    static void scheduler_Starting(object sender, EventArgs e)
    {
        Console.WriteLine("Scheduler is waiting to be started.");
    }

    static void scheduler_ScheduleDue(object sender, EventArgs<Schedule> e)
    {
        Console.WriteLine(string.Format("{0} schedule is due for processing.", e.Argument.Name));
    }
}
See Also