Click or drag to resize
Task Scheduler Managed Class Library

EventTrigger Class

Represents a trigger that starts a task when a system event occurs.
Note Note
Only available for Task Scheduler 2.0 on Windows Vista or Windows Server 2003 and later.
Inheritance Hierarchy

Namespace:  Microsoft.Win32.TaskScheduler
Assembly:  Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.10.1
Syntax
public sealed class EventTrigger : Trigger, 
	ITriggerDelay
Request Example View Source

The EventTrigger type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyDelay
Gets or sets a value that indicates the amount of time between when the system is booted and when the task is started.
Public propertyEnabled
Gets or sets a Boolean value that indicates whether the trigger is enabled.
(Inherited from Trigger.)
Public propertyEndBoundary
Gets or sets the date and time when the trigger is deactivated. The trigger cannot start the task after it is deactivated.
Note Note
While the maximum value for this property is MaxValue, the Windows Task Scheduler management application that is part of the OS will fail if this value is greater than December 31, 9998.
(Inherited from Trigger.)
Public propertyExecutionTimeLimit
Gets or sets the maximum amount of time that the task launched by this trigger is allowed to run. Not available with Task Scheduler 1.0.
(Inherited from Trigger.)
Public propertyId
Gets or sets the identifier for the trigger. Cannot set with Task Scheduler 1.0.
(Inherited from Trigger.)
Public propertyRepetition
Gets a RepetitionPattern instance that indicates how often the task is run and how long the repetition pattern is repeated after the task is started.
(Inherited from Trigger.)
Public propertyStartBoundary
Gets or sets the date and time when the trigger is activated.
(Inherited from Trigger.)
Public propertySubscription
Gets or sets the XPath query string that identifies the event that fires the trigger.
Public propertyTriggerType
Gets the type of the trigger.
(Inherited from Trigger.)
Public propertyValueQueries
Gets a collection of named XPath queries. Each query in the collection is applied to the last matching event XML returned from the subscription query specified in the Subscription property. The name of the query can be used as a variable in the message of a ShowMessageAction action.
Top
Methods
  NameDescription
Public methodStatic memberBuildQuery
Builds an event log XML query string based on the input parameters.
Protected methodCheckBindValue
Checks the bind value for any conversion.
(Inherited from Trigger.)
Public methodClone
Creates a new Trigger that is an unbound copy of this instance.
(Inherited from Trigger.)
Public methodCompareTo
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
(Inherited from Trigger.)
Public methodCopyProperties
Copies the properties from another Trigger the current instance. This will not copy any properties associated with any derived triggers except those supporting the ITriggerDelay interface.
(Overrides TriggerCopyProperties(Trigger).)
Public methodDispose
Releases all resources used by this class.
(Inherited from Trigger.)
Public methodEquals(Object)
Determines whether the specified Object, is equal to this instance.
(Inherited from Trigger.)
Public methodEquals(Trigger)
Indicates whether the current object is equal to another object of the same type.
(Overrides TriggerEquals(Trigger).)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetBasic
Gets basic event information.
Public methodGetHashCode
Returns a hash code for this instance.
(Inherited from Trigger.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodGetUnboundValueOrDefaultT
Gets the unbound value or a default.
(Inherited from Trigger.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnNotifyPropertyChanged
Called when a property has changed to notify any attached elements.
(Inherited from Trigger.)
Public methodSetBasic
Sets the subscription for a basic event. This will replace the contents of the Subscription property and clear all entries in the ValueQueries property.
Public methodSetRepetition Obsolete.
Sets the repetition.
(Inherited from Trigger.)
Public methodToString
Returns a string representing this trigger.
(Inherited from Trigger.)
Public methodToString(CultureInfo)
Returns a String that represents this trigger in a specific language.
(Inherited from Trigger.)
Protected methodV2GetTriggerString
Gets the non-localized trigger string for V2 triggers.
(Overrides TriggerV2GetTriggerString.)
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Trigger.)
Top
Fields
  NameDescription
Protected fieldunboundValues
In testing and may change. Do not use until officially introduced into library.
(Inherited from Trigger.)
Top
Remarks
The EventTrigger runs when a system event fires.
Examples
C#
// Create a trigger that will fire whenever a level 2 system event fires.
EventTrigger eTrigger = new EventTrigger();
eTrigger.Subscription = @"<QueryList><Query Id='1'><Select Path='System'>*[System/Level=2]</Select></Query></QueryList>";
eTrigger.ValueQueries.Add("Name", "Value");
See Also