Click or drag to resize
ScheduledUpdater Class
ScheduledUpdater is a helper class handles scheduling and unscheduling of delegates for execution by an IScheduler.
Inheritance Hierarchy
SystemObject
  Microsoft.IoT.DeviceCoreScheduledUpdater

Namespace: Microsoft.IoT.DeviceCore
Assembly: Microsoft.IoT.DeviceCore (in Microsoft.IoT.DeviceCore.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public sealed class ScheduledUpdater : IClosable, 
	IEventObserver, IStringable

The ScheduledUpdater type exposes the following members.

Constructors
  NameDescription
Public methodScheduledUpdater(ScheduleOptions)
Initializes a new ScheduledUpdater using the default scheduler.
Public methodScheduledUpdater(ScheduleOptions, IScheduler)
Initializes a new ScheduledUpdater instance.
Top
Properties
  NameDescription
Public propertyIsStarted
Gets a value that indicates if the updater is currently providing updates.
Public propertyScheduleOptions
Gets the schedule options currently being used by the scheduler.
Public propertyScheduler
Gets the scheduler that is providing updates.
Public propertyStartWithEvents
Gets or sets a value that indicates if Start will get called when the first event is subscribed to.
Public propertyStopWithEvents
Gets or sets a value that indicates if Stop will get called when the last event is unsubscribed.
Public propertyUpdateInterval
Gets or sets the update interval.
Top
Methods
  NameDescription
Public methodClose
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodSetAsyncUpdateAction
Sets an asynchronous update action to be called by the scheduler.
Public methodSetUpdateAction
Sets a synchronous update action to be called by the scheduler.
Public methodStart
Starts executing updates with the scheduler.
Public methodStop
Stops updates from being executed by the scheduler.
Public methodToString (Inherited from Object.)
Top
Events
  NameDescription
Public eventStarted
Occurs right after updates have been started with the scheduler.
Public eventStarting
Occurs right before updates are started with the scheduler.
Public eventStopped
Occurs right after updates are stopped with the scheduler.
Public eventStopping
Occurs right before updates are stopped with the scheduler.
Top
Remarks

ScheduledUpdater is capable of delivering both synchronous and asynchronous through the SetUpdateAction(ScheduledAction) and SetAsyncUpdateAction(ScheduledAsyncAction) methods respectively.

ScheduledUpdater is commonly used in device classes to schedule polling of device data. Devices that share the same IScheduler automatically share time slices on a CPU. Whenever a ScheduledUpdater is created using a constructor that doesn't explicitly receive an IScheduler instance, Default is automatically used.

Because ScheduledUpdater is commonly used by devices (especially sensors) there is a common need is to start updates when one or more device events are subscribed to then stop updates when the last subscription is removed. To help with this common scenario, ScheduledUpdater implements the IEventObserver interface which means it can be passed to the constructor of any ObservableEvent (included in the Microsoft.IoT.DeviceHelpers library).

See Also