« ExecuteAsTask (TTaskConfigureController) » : différence entre les versions

De Wiki1000
(Page créée avec « <source lang='delphi'>function ExecuteAsTask(var aReason:string):boolean;</source> Cette méthode exécute la tâche en asynchrone. {|class="wikitable" |- |Result |True ... »)
 
m (a déplacé ExecuteAsTask (TTaskFormController) vers ExecuteAsTask (TTaskConfigureController) : Remplacement du texte — « TTaskFormController » par « TTaskConfigureController »)
 
(2 versions intermédiaires par le même utilisateur non affichées)
Ligne 16 : Ligne 16 :


<source lang="delphi">
<source lang="delphi">
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;
</source>
</source>


Voir aussi
Voir aussi


{{Footer|TTaskFormController_(class)}}
{{Footer|TTaskConfigureController_(class)}}
[[Category:TTaskFormController]]
[[Category:TTaskConfigureController]]

Dernière version du 20 novembre 2019 à 15:56

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