wwDotNetBridge::InvokeStaticMethodAsync

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

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

Parameters

loCallback
An instance of the CallbackAsyncEvents object with OnCompleted()?and OnError methods implemented.

lcTypeName
String of the .NET type on which the method to call exists( ie. "System.Environment")

lcMethod
The method to call on the static type. (ie. "GetEnvironmentVariables()")

lvParm1-lvParm10
0 to 10 parameters to pass to the method.

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

© West Wind Technologies, 1996-2018 • Updated: 12/23/15
Comment or report problem with topic