Rogue Wave Server Component library for .NET Reference Guide
|
|
MvComponentExecDuplexGlobalCallbackAsync Method |
This function executes a global callback on the server and get its result in
an asynchronous task.
Namespace: RW.Server.Component
Assembly: RW.Server.Component (in RW.Server.Component.dll) Version: 7.0.0.0 (7.0.0.0)
Parameters
- funNm
- Type: SystemString
Name of the callback to execute on server side. - args
- Type: RW.Server.ComponentMvValue
Arguments to send to the server callback.
Return Value
Type: TaskMvValueAn asynchronous result.
MvValue[] parameters = new MvValue[2]; parameters[0] = new MvValue(42); parameters[1] = new MvValue(51); var tresult = _component.ExecDuplexGlobalCallbackAsync("Multiply", parameters); Task.Run(() => { try { var result = tresult.Result; Console.WriteLine(" Duplex result = " + result.AsString()); } catch(AggregateException e) { Console.WriteLine(" Duplex result canceled."); } });
In an asynchronous function, you can use:
MvValue[] parameters = new MvValue[2]; parameters[0] = new MvValue(42); parameters[1] = new MvValue(51); try { MvValue result = await _component.ExecDuplexGlobalCallbackAsync("Multiply", parameters); Console.WriteLine(result.AsString()); } catch(TaskCanceledException e) { Console.WriteLine(" Duplex result canceled."); }