A
arfing
Hi,
I am pulling my hair out trying to get my compact framework 2 app.
running on windows mobile 5 to wake every minute and do some
background processing.
I have read a lot of interesting posts but none seem to match what I'm
trying to do . i.e. in vb.net
What I'm trying to do is create a named event every 60 seconds so i
can raise an event and do some processing. The event however never
seems to fire ?
I have listed the code below. Any help is greatly appreciated.
Public Sub HandlerNotifications()
Try
DebugLog("MessageReminder Started")
NotificationEvent = New
OpenNETCF.Threading.EventWaitHandle(False,
OpenNETCF.Threading.EventResetMode.AutoReset, "StartME")
Notify.RunAppAtTime("\\.\Notifications\NamedEvents
\StartME", DateTime.Now.AddSeconds(60))
While bLeaving = False
DebugLog("MessageReminder Wait For event to Fire")
' Wait for the notification event to fire.
NotificationEvent.WaitOne()
DebugLog("MessageReminder Event Fired")
'Prevent firing Notify_Fired twice (was necessary in
my case)
System.Threading.Thread.Sleep(2000)
' Let the notification subsystem know that we're done
with the event.
Try
DebugLog("MessageReminder - Clear the event")
Notify.RunAppAtTime("\\.\Notifications\NamedEvents
\StartME", DateTime.MinValue)
Catch e As Exception
DebugLog("MessageReminder Error ", e)
End Try
' RaiseEvent NetworkConnect()
' Close event handle.
NotificationEvent.Close()
If bLeaving = False Then
DebugLog("MessageReminder Re init Listen for
event")
' Recreate the event for notification.
NotificationEvent = New
OpenNETCF.Threading.EventWaitHandle(False,
OpenNETCF.Threading.EventResetMode.AutoReset, "StartME")
DebugLog("MessageReminder Re create disconnect
monitor")
Notify.RunAppAtTime("\\.\Notifications\NamedEvents
\StartME", Now.AddSeconds(60))
End If
DebugLog("MessageReminder Re init Listen for Re
Submitted")
End While
DebugLog("MessageReminder Re init Listen for Completed")
Catch ex As Exception
DebugLog("MessageReminder Error ", ex)
End Try
End Sub
I am pulling my hair out trying to get my compact framework 2 app.
running on windows mobile 5 to wake every minute and do some
background processing.
I have read a lot of interesting posts but none seem to match what I'm
trying to do . i.e. in vb.net
What I'm trying to do is create a named event every 60 seconds so i
can raise an event and do some processing. The event however never
seems to fire ?
I have listed the code below. Any help is greatly appreciated.
Public Sub HandlerNotifications()
Try
DebugLog("MessageReminder Started")
NotificationEvent = New
OpenNETCF.Threading.EventWaitHandle(False,
OpenNETCF.Threading.EventResetMode.AutoReset, "StartME")
Notify.RunAppAtTime("\\.\Notifications\NamedEvents
\StartME", DateTime.Now.AddSeconds(60))
While bLeaving = False
DebugLog("MessageReminder Wait For event to Fire")
' Wait for the notification event to fire.
NotificationEvent.WaitOne()
DebugLog("MessageReminder Event Fired")
'Prevent firing Notify_Fired twice (was necessary in
my case)
System.Threading.Thread.Sleep(2000)
' Let the notification subsystem know that we're done
with the event.
Try
DebugLog("MessageReminder - Clear the event")
Notify.RunAppAtTime("\\.\Notifications\NamedEvents
\StartME", DateTime.MinValue)
Catch e As Exception
DebugLog("MessageReminder Error ", e)
End Try
' RaiseEvent NetworkConnect()
' Close event handle.
NotificationEvent.Close()
If bLeaving = False Then
DebugLog("MessageReminder Re init Listen for
event")
' Recreate the event for notification.
NotificationEvent = New
OpenNETCF.Threading.EventWaitHandle(False,
OpenNETCF.Threading.EventResetMode.AutoReset, "StartME")
DebugLog("MessageReminder Re create disconnect
monitor")
Notify.RunAppAtTime("\\.\Notifications\NamedEvents
\StartME", Now.AddSeconds(60))
End If
DebugLog("MessageReminder Re init Listen for Re
Submitted")
End While
DebugLog("MessageReminder Re init Listen for Completed")
Catch ex As Exception
DebugLog("MessageReminder Error ", ex)
End Try
End Sub