New Asynchronous Handling Methods in VLF-ONE

http://docs.lansa.com/14/EN/lansa048/content/resources/images/lansa/vlf%20one.png

VLF-ONE filters and command handlers now inherit new and simplified asynchronous handling methods.

These new methods automatically implement the most common activities performed in an asynchronous interaction with a server module, such as:

For example, a button Click event handler could queue up an asynchronous operation identified as Operation_1 like this:  

Ultimately operation 1 is handled (asynchronously) by an overwritten method like this:

 

Note how the associated #COM_OWNER.avQueueAsyncOperation can pass (ie: send) two simple string parameters and two object references along in the queued asynchronous request.  

Multiple asynchrounous requests can be queued.

The avExecuteAsyncOperation method can queue further (resultant) asynchronous operations.

You can also listen for event avAsyncOperationsCompleted.

This small example command handler demonstrates several of the major asynchronous features:

 

Begin_Com Role(*EXTENDS #VF_AC010O) Height(241) Width(457)

Define_Com Class(#PRIM_LABL) Name(#VisibleCounter) Displayposition(1) Height(129) Left(16) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(56) Width(401) Verticalalignment(Center) Style(#BigFont) Caption('Stopped') Alignment(Center)

Define_Com Class(#Prim_phbn) Name(#StartCount) Parent(#COM_OWNER) Caption('Start Count') Displayposition(3) Tabposition(3)

Define_Com Class(#Prim_phbn) Name(#StopCount) Parent(#COM_OWNER) Caption('Stop Count') Displayposition(2) Tabposition(2) Left(96)

Define_Com Class(#Prim_vs.Style) Name(#BigFont) Fontsize(72) Textcolor(Blue)

* ------------------------------------------------------------------------------

Evtroutine Handling(#StartCount.Click)

Define_Com Class(#std_Int) Name(#PhysicalCounter)

#Com_Owner.avQueueAsyncOperation Operationid(Count) Parameterreference1(#PhysicalCounter)

Endroutine

* ------------------------------------------------------------------------------

Evtroutine Handling(#StopCount.Click)

#Com_Owner.avQueueAsyncOperation Operationid(Stop)

Endroutine

* ------------------------------------------------------------------------------

Mthroutine Name(avExecuteAsyncOperation) Options(*REDEFINE)

Define_Com Class(#std_Int) Name(#UseCounter) Reference(*DYNAMIC)

Case (#OperationID)

When (= Count)

#UseCounter <= #ParameterReference1 *As #Std_Int

#UseCounter += 1

#VisibleCounter := #UseCounter.AsString

#Com_Owner.avQueueAsyncOperation Operationid(Count) Parameterreference1(#UseCounter)

When (= Stop)

#VisibleCounter := "Stopped"

#KillOtherPendingOperations := True

Otherwise

#SYS_WEB.Alert Caption("Unknown operation id " + #OperationID)

Endcase

Endroutine

End_Com

 

When executed it looks like this: