RepetitionPattern Class

Defines how often the task is run and how long the repetition pattern is repeated after the task is started.

Definition

Namespace: Microsoft.Win32.TaskScheduler
Assembly: Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.11.1
[XmlRootAttribute("Repetition", Namespace = "http://schemas.microsoft.com/windows/2004/02/mit/task", 
	IsNullable = true)]
public sealed class RepetitionPattern : IDisposable, 
	IXmlSerializable, IEquatable<RepetitionPattern>, INotifyPropertyChanged
Inheritance
Object    RepetitionPattern
Implements
INotifyPropertyChanged, IDisposable, IEquatableRepetitionPattern, IXmlSerializable

Remarks

This can be used directly or by assignment for a Trigger.

Example

C#
// Create a time trigger with a repetition
var tt = new TimeTrigger(new DateTime().Now.AddHours(1));
// Set the time in between each repetition of the task after it starts to 30 minutes.
tt.Repetition.Interval = TimeSpan.FromMinutes(30); // Default is TimeSpan.Zero (or never)
// Set the time the task will repeat to 1 day.
tt.Repetition.Duration = TimeSpan.FromDays(1); // Default is TimeSpan.Zero (or never)
// Set the task to end even if running when the duration is over
tt.Repetition.StopAtDurationEnd = true; // Default is false;

// Do the same as above with a constructor
tt = new TimeTrigger(new DateTime().Now.AddHours(1)) { Repetition = new RepetitionPattern(TimeSpan.FromMinutes(30), TimeSpan.FromDays(1), true) };

Constructors

RepetitionPatternInitializes a new instance of the RepetitionPattern class.

Properties

DurationGets or sets how long the pattern is repeated.
IntervalGets or sets the amount of time between each restart of the task.
StopAtDurationEnd Gets or sets a Boolean value that indicates if a running instance of the task is stopped at the end of repetition pattern duration.

Methods

DisposeReleases all resources used by this class.
Equals(Object)Determines whether the specified Object, is equal to this instance.
(Overrides ObjectEquals(Object))
Equals(RepetitionPattern)Indicates whether the current object is equal to another object of the same type.
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeReturns a hash code for this instance.
(Overrides ObjectGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
IsSetDetermines whether any properties for this RepetitionPattern have been set.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ToStringReturns a string that represents the current object.
(Inherited from Object)

Events

PropertyChangedOccurs when a property value changes.

See Also