Visual LANSA フレームワーク ガイド > 新機能 > EPC141034 – 2017 年 8月 > 新しい VLF-ONE の非同期処理メソッド

新しい VLF-ONE の非同期処理メソッド

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

VLF-ONE フィルターとコマンド・ハンドラーが、新しく簡素化された非同期処理メソッドを継承するようになりました。

これらの新メソッドは、サーバー・モジュールと非同期にやり取りする共通のアクティビティの中で最も一般的なものを自動的に導入します。例えば次のようなアクティビティです。

例えば、ボタンのクリック・イベント・ハンドラーは、次のように Operation_1 という識別子の非同期処理のキューに加えることができます。 

最終的に operation 1 は次のように上書きされたメソッドにより、(非同期に) 処理されます。

 

関連付けられた #COM_OWNER.avQueueAsyncOperation は、キューに入れられた非同期要求とともに、簡単な文字列パラメータと 2 つのオブジェクト参照を引き渡す (送信する) ことができることを確認してください。  

複数の非同期要求をキューに入れることもできます。

avExecuteAsyncOperation メソッドは、さらに (結果の) 非同期処理をキューに入れることができます。

また、イベント avAsyncOperationsCompleted をリスンすることもできます。

次の小さな例では、コマンド・ハンドラーの主な非同期の機能がいくつか紹介されています。

 

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

 

これを実行すると、次のようになります。