Language: Add new Watch class

This commit is contained in:
Jonathan Jenne 2020-11-20 16:09:42 +01:00
parent d0e4ecb4ed
commit cd24795a0b
2 changed files with 24 additions and 0 deletions

View File

@ -90,6 +90,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Watch.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">

23
Modules.Language/Watch.vb Normal file
View File

@ -0,0 +1,23 @@
Public Class Watch
Private ReadOnly _StopWatch As Stopwatch
Private ReadOnly _Name As String
Public Sub New(pName As String)
_StopWatch = New Stopwatch()
_StopWatch.Start()
_Name = pName
Debug.WriteLine($"Starting [{pName}].")
End Sub
Public Sub Restart()
_StopWatch.Restart()
Debug.WriteLine($"Starting [{_Name}].")
End Sub
Public Sub [Stop]()
_StopWatch.Stop()
Debug.WriteLine($"Stopped [{_Name}] after {_StopWatch.Elapsed.TotalSeconds} seconds.")
End Sub
End Class