All Control.Invoke targets in CF must use EventHandler signature:
void Handler(object, EventArgs)
--
Alex Feinman
---
Visit
http://www.opennetcf.org
"Hauer Wolfgang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi!
>
> I have an baseclass in the full framework wich encapsulates threading.
> Recently i have expanded it for throwing an event when the thread has
> finished. Because the event runs on the calling thread, i make a
> control.invoke(delegate). This runs fine in the full framework, but
> crashes with an argument-exception in cf.
> Has someone an idea what could be wrong?
> Thanks-Danke Wolfgang
> -------------------->
> Imports System.Windows.Forms
> Public MustInherit Class ThreadWrapperBase
> Public ReadOnly Thread As System.Threading.Thread
> Private bmDone As Boolean
> Protected Event ThreadDone(ByVal Sender As Object)
> Private omControl As Control
> Delegate Sub ThreadDoneDelegate()
> Private MyThreadDoneDelegate As ThreadDoneDelegate = New
> ThreadDoneDelegate(AddressOf LocalThreadDone)
>
> Public Property Control() As Control
> Get
> Return omControl
> End Get
> Set(ByVal Value As Control)
> omControl = Value
> End Set
> End Property
>
> Sub New()
> Me.Thread = New System.threading.Thread(AddressOf RunThread)
> End Sub
>
> Sub New(ByVal InvokerControl As Control)
> Me.New()
> omControl = InvokerControl
> End Sub
>
> Overridable Sub Start()
> Me.Thread.Start()
> End Sub
>
> Private Sub RunThread()
> bmDone = False
> OnStart()
> bmDone = True
> if Not omControl Is Nothing Then
> omControl.Invoke(MyThreadDoneDelegate)
> ###############> Problem is here
> ###################################################################################
> Else
> LocalThreadDone()
> End If
> End Sub
> ReadOnly Property Done() As Boolean
> Get
> Return bmDone
> End Get
> End Property
> Private Sub LocalThreadDone()
> RaiseEvent ThreadDone(Me)
> End Sub
> Protected MustOverride Sub OnStart()
> End Class
>
>
>