wwDotNetBridge::InvokeStaticMethodAsync

Invokes a .NET static method asynchronously on a seperate thread and fires OnCompleted() and OnError() events into the passed in Callback object.

Uses the same mechanism as wwDotNetBridge::InvokeMethodAsync.

o.InvokeStaticMethodAsync(loCallback,lcTypeName,lcMethod,lvParm1-10)

Parameters

loCallback
An instance of the CallbackAsyncEvents object with OnCompleted()

Example

loBridge = CreateObject("wwDotNetBridge","V4")

loTests = loBridge.CreateInstance("Westwind.WebConnection.TypePassingTests")

*** IMPORTANT: The callback object must remain in scope
***            Either use a public var, or attach to an object that
***            stays in scope for the duration of the callback
PUBLIC loCallback
loCallback = CREATEOBJECT("MyCallback")

*** This methods returns immediately - then fire events when done
loBridge.InvokeStaticMethodAsync(loCallback,loTests,"HelloWorldStatic","Ricj")

RETURN

*** Handle result values in this object
*** The callback object is called back 
*** when the method completes or fails
DEFINE CLASS MyCallback as AsyncCallbackEvents

FUNCTION OnCompleted(lvResult,lcMethod)
? "Success: " + lcMethod,lvResult
ENDFUNC

FUNCTION OnError(lcMessage,loException,lcMethod)
? "Error: " + lcMethod,lcMessage
ENDFUNC

ENDDEFINE

See also:

Class wwDotNetBridge | wwDotNetBridge::InvokeMethodAsync | Class AsyncCallbackEvents

© West Wind Technologies, 1996-2024 • Updated: 03/11/19
Comment or report problem with topic