ExecuteAsTask (TTaskConfigureController)

De Wiki1000
(Différences entre les versions)
m (Remplacement du texte — « TTaskFormController » par « TTaskConfigureController »)
Ligne 17 : Ligne 17 :
 
<source lang="delphi">
 
<source lang="delphi">
 
function doExecuteMyTask:string;
 
function doExecuteMyTask:string;
var inst:TTaskFormController; myCallBack:myCallBackTask; aReason:string;
+
var inst:TTaskConfigureController; myCallBack:myCallBackTask; aReason:string;
 
begin
 
begin
 
   // Instance of the call which must be called after execution of the task
 
   // Instance of the call which must be called after execution of the task
Ligne 23 : Ligne 23 :
 
   myCallBack := myCallBackTask.Create;
 
   myCallBack := myCallBackTask.Create;
  
   inst := TTaskFormController.Create;
+
   inst := TTaskConfigureController.Create;
  
 
   // Previously configured parameters
 
   // Previously configured parameters
Ligne 46 : Ligne 46 :
 
Voir aussi
 
Voir aussi
  
{{Footer|TTaskFormController_(class)}}
+
{{Footer|TTaskConfigureController_(class)}}
[[Category:TTaskFormController]]
+
[[Category:TTaskConfigureController]]

Version du 20 novembre 2019 à 16:55

function ExecuteAsTask(var aReason:string):boolean;

Cette méthode exécute la tâche en asynchrone.

Result True : Succès, False : Erreur de création de la tâche
aReason Information sur l'erreur


Exemple :

function doExecuteMyTask:string;
var inst:TTaskConfigureController; myCallBack:myCallBackTask; aReason:string;
begin
  // Instance of the call which must be called after execution of the task
  // Just need to retreive the EventID of the call back
  myCallBack := myCallBackTask.Create;
 
  inst := TTaskConfigureController.Create;
 
  // Previously configured parameters
  inst.TaskParameters := myProcessusParameters;
 
  // In the case the task generate a document (for example a report)
  // We want to generate a document and to attach it to the main object
  // (The main object may be any persistent object)
  inst.DocumentAttachOID := mainObject.InstanceOID; 
 
  // We want to generate an event to execute asynchronously a call back
  inst.TaskEventID := myCallBack.EventID;
 
  // We want to retreive the log entry for this task
  inst.TaskReference := InstanceOID;
 
  // Execute asynchronously
  inst.ExecuteAsTask(aReason);
end;

Voir aussi

TTaskConfigureController_(class)Développement DSM

Outils personnels