Sdílet prostřednictvím


Timer.Change Method (UInt32, UInt32)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Changes the start time and the interval between method invocations for a timer, using 32-bit unsigned integers to measure time intervals.

This API is not CLS-compliant. 

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
Public Function Change ( _
    dueTime As UInteger, _
    period As UInteger _
) As Boolean
[CLSCompliantAttribute(false)]
public bool Change(
    uint dueTime,
    uint period
)

Parameters

  • dueTime
    Type: System.UInt32
    The amount of time to delay before the invoking the callback method that was specified when the Timer was constructed, in milliseconds. Specify UInt32.MaxValue to prevent the timer from restarting. Specify 0 (zero) to restart the timer immediately.
  • period
    Type: System.UInt32
    The time interval between invocations of the callback method that was specified when the Timer was constructed, in milliseconds. Specify UInt32.MaxValue to disable periodic signaling.

Return Value

Type: System.Boolean
true if the timer was successfully updated; otherwise, false.

Exceptions

Exception Condition
ObjectDisposedException

The Timer has already been disposed.

Remarks

The callback method is invoked once after dueTime elapses, and thereafter each time the time interval specified by period elapses.

If dueTime is 0 (zero), the callback method is invoked immediately. If dueTime is UInt32.MaxValue, the callback method is never invoked; the timer is disabled but can be re-enabled by calling Change and specifying a positive value for dueTime.

If period is 0 (zero) or UInt32.MaxValue, and dueTime is not UInt32.MaxValue, the callback method is invoked once; the periodic behavior of the timer is disabled but can be re-enabled by calling Change and specifying a positive value for period.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Other Resources