Windows Service com Timer (timer não funciona) RRS feed


  • VB.Net

    Public Class Fila_CA_USD_IBM

        Private oTimer As System.Threading.Timer

        Protected Overrides Sub OnStart(ByVal args() As String)
            ' Add code here to start your service. This method should set things
            ' in motion so your service can do its work.

            Dim oCallback As New System.Threading.TimerCallback(AddressOf OnTimedEvent)
            oTimer = New System.Threading.Timer(oCallback, Nothing, 60000, 60000)
            System.Diagnostics.EventLog.WriteEntry("INICIOOU", "INICIOOU", EventLogEntryType.SuccessAudit)
        End Sub


        Protected Overrides Sub OnStop()
            ' Add code here to perform any tear-down necessary to stop your service.

        End Sub


        Private Sub OnTimedEvent(ByVal state As Object)

            System.Diagnostics.EventLog.WriteEntry("teste", "teste " & Now.ToString, EventLogEntryType.SuccessAudit)
            End Sub

    End Class

    quinta-feira, 21 de fevereiro de 2008 18:11

Todas as Respostas