ExecuteTask (TitTask)

De Wiki1000
(Différences entre les versions)
(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 ... »)
 
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

Version du 24 mai 2019 à 11:57

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.
Exclam-20px.png 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





Whos here now:   Members 0   Guests 0   Bots & Crawlers 1
 
Outils personnels