« ExecuteTask (TitTask) » : différence entre les versions

De Wiki1000
(Page créée avec « <source lang='delphi'>function ExecuteTask(var aReason:string):boolean;</source> Cette fonction exécute la tâche. * Si la gestion des tâche est configurée la tâche ... »)
 
Aucun résumé des modifications
 
(2 versions intermédiaires par le même utilisateur non affichées)
Ligne 36 : Ligne 36 :
     // doesn't mean that the task has been executed  
     // doesn't mean that the task has been executed  
     //
     //
     if task.ResultCode = trStarted then
     if task.WasAsync then
       begin
       begin
         // The task has been posted
         // The task has been postponed
         // Async execution
         // Async execution
       end
       end
       else
       else
       begin
       begin
         // The task has been executed and return OK
         // The task has been executed synchronously
       end;
       end;
   end
   end
Ligne 53 : Ligne 53 :
</source>
</source>


Voir aussi
Voir aussi :
* [[ResultAsync (TitTask)|ResultAsync]]
* [[ResultCode (TitTask)|ResultCode]]


{{Footer|Classe_tâche_(stereotype)}}
{{Footer|Classe_tâche_(stereotype)}}
[[Category:Stéréotype tâche]]
[[Category:Stéréotype tâche]]

Dernière version du 24 mai 2019 à 11:16

function ExecuteTask(var aReason:string):boolean;

Cette fonction exécute la tâche.

  • Si la gestion des tâche est configurée la tâche sera exécutée de manière asynchrone.
  • Si la gestion des tâches n'est pas configurée la tâche est exécutée de manière synchrone.
Paramètre Usage
aReason Informations sur l'erreur
Result True si l'exécution à réussi.
Attention : Si l'exécution est asynchrone une valeur de retour True signifie que la tâche a été correctement posté

Exemple :

//procedure ExecuteMyTask;
var task:TMyTask; aReason:string;
begin
  task := TMyTask.Create;
  //
  // Set parameters
  // ...
  //
  if task.ExecuteTask(aReason) then
   begin
     // execute task OK
     // doesn't mean that the task has been executed 
     //
     if task.WasAsync then
      begin
        // The task has been postponed
        // Async execution
      end
      else
      begin
        // The task has been executed synchronously
      end;
   end
   else
   begin
     // something goes wrong
   end;
end;

Voir aussi :

Classe_tâche_(stereotype)Développement DSM