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

Respostas

  • 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

     

    http://csharpstruggles.blogspot.com/2005/02/using-timer-in-windows-service.html


    http://technet2.microsoft.com/windowsserver/en/library/71e76587-28f4-4272-a3d7-7f44ca50c0181033.mspx?mfr=true
    quinta-feira, 21 de fevereiro de 2008 18:11

Todas as Respostas