Click or drag to resize
Task Scheduler Managed Class Library

RepetitionPattern Class

Defines how often the task is run and how long the repetition pattern is repeated after the task is started.
Inheritance Hierarchy
SystemObject
  Microsoft.Win32.TaskSchedulerRepetitionPattern

Namespace:  Microsoft.Win32.TaskScheduler
Assembly:  Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.10.1
Syntax
public sealed class RepetitionPattern : IDisposable, 
	IXmlSerializable, IEquatable<RepetitionPattern>, INotifyPropertyChanged
Request Example View Source

The RepetitionPattern type exposes the following members.

Constructors
  NameDescription
Public methodRepetitionPattern
Initializes a new instance of the RepetitionPattern class.
Top
Properties
  NameDescription
Public propertyDuration
Gets or sets how long the pattern is repeated.
Public propertyInterval
Gets or sets the amount of time between each restart of the task.
Public propertyStopAtDurationEnd
Gets or sets a Boolean value that indicates if a running instance of the task is stopped at the end of repetition pattern duration.
Top
Methods
  NameDescription
Public methodDispose
Releases all resources used by this class.
Public methodEquals(Object)
Determines whether the specified Object, is equal to this instance.
(Overrides ObjectEquals(Object).)
Public methodEquals(RepetitionPattern)
Indicates whether the current object is equal to another object of the same type.
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 methodGetHashCode
Returns a hash code for this instance.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsSet
Determines whether any properties for this RepetitionPattern have been set.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property value changes.
Top
Remarks
This can be used directly or by assignment for a Trigger.
Examples
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) };
See Also