public sealed class TimeMeasurer : IDisposable
Public NotInheritable Class TimeMeasurer
Implements IDisposable
Dim instance As TimeMeasurer
public ref class TimeMeasurer sealed : IDisposable
[<SealedAttribute>]
type TimeMeasurer =
class
interface IDisposable
end
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
Public Class Form1 : Inherits Form
''' ----------------------------------------------------------------------------------------------------
''' <summary>
''' A <see cref="TimeMeasurer"/> instance which is used as a chronometer.
''' </summary>
''' ----------------------------------------------------------------------------------------------------
Private WithEvents chrono As New TimeMeasurer With {.UpdateInterval = 100}
' Label used to display the elapsed time.
Private lblChrono As Label
Private Shadows Sub Shown() Handles MyBase.Shown
Me.lblChrono = Me.Label1
Me.chrono.Start(TimeSpan.FromMinutes(1.0R))
End Sub
''' ----------------------------------------------------------------------------------------------------
''' <summary>
''' Handles the <see cref="TimeMeasurer.TimeUpdated"/> event of the chrono instance.
''' </summary>
''' ----------------------------------------------------------------------------------------------------
''' <param name="sender">
''' The source of the event.
''' </param>
'''
''' <param name="e">
''' The <see cref="TimeMeasurerUpdatedEventArgs"/> instance containing the event data.
''' </param>
''' ----------------------------------------------------------------------------------------------------
Private Sub Chrono_TimeUpdated(ByVal sender As Object, ByVal e As TimeMeasurerUpdatedEventArgs) _
Handles chrono.TimeUpdated
' H:M:S:MS
Me.lblChrono.Text = String.Format("{0:00}:{1:00}:{2:00}:{3:000}",
e.Elapsed.Hours, e.Elapsed.Minutes, e.Elapsed.Seconds, e.Elapsed.Milliseconds)
If (e.Elapsed = e.Goal) Then
Me.lblChrono.Text = "Chronometer Done!"
End If
End Sub
End Class
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
TimeMeasurer | Initializes a new instance of the TimeMeasurer class. |
MaxValue | Gets the maximum time that the TimeMeasurer can measure, in milliseconds. |
State | Gets the current state of this TimeMeasurer instance. |
UpdateInterval | Gets or sets the update interval. Maximum value is 1000 (1 second). |
Dispose | Releases all the resources used by this instance. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetType | Gets the Type of the current instance. (Inherited from Object) |
Pause | Pauses the time interval measurement. |
Resume | Resumes the time interval measurement. |
Start(Double) | Starts the time interval measurement. |
Start(TimeSpan) | Starts a time interval measurement given a TimeSpan. |
Start(DateTime, DateTime) | Starts a time interval measurement given a difference between two dates. |
Stop | Stops the time interval measurement. |
ToString | Returns a string that represents the current object. (Inherited from Object) |
TimeUpdated | Occurs when the elapsed/remaining time updates. |
CanConvertTo |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
CanConvertToT |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions) |
IsDisposable |
Determines whether the specified object is a disposable type
(i.e., it implements IDisposable interface).
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
ThrowIfNullTException |
Throws the specified exception if the source object is null.
(Defined by ObjectExtensions) |