Public Class TimeStamper
    Private filePath As String
    Private statusLabel As ToolStripItem

    Public Sub New(ByVal filePath As String)
        Me.filePath = filePath
    End Sub

    Public Sub New(ByVal filePath As String, ByVal statusLabel As ToolStripItem)
        Me.filePath = filePath
        Me.statusLabel = statusLabel
    End Sub

    Private LastUpdate As DateTime
    Public Sub WriteRegularTimeStamp()
        Do
            ' Zapis do pliku co 10 sekund.
            If DateTime.Now.Subtract(LastUpdate).TotalSeconds > 10 Then
                My.Computer.FileSystem.WriteAllText( _
                  filePath, DateTime.Now.ToLongTimeString + vbNewLine, True)
                LastUpdate = DateTime.Now

                ' Aktualizacja w odpowiednim wątku.
                Dim method As New MethodInvoker(AddressOf UpdateStatusLabel)
                statusLabel.Owner.Invoke(method)
            End If
        Loop
    End Sub

    Private Sub UpdateStatusLabel()
        statusLabel.Text = "Plik zaktualizowano o " + LastUpdate.ToLongTimeString()
    End Sub
End Class
