How to cancel RunAutomaticTask manually

Hi,

  I use an asynchronous thread to manipulate a project using FileBasedProject.RunAutomaticTask calls. However, the PopulateProjectTranslationMemories task sometimes takes too long and I want the user to be able to cancel it with a button. 

  According to the GUI documentation, events assigned in RunAutomaticTask(Guid[], String, EventHandler<TaskStatusEventArgs>, EventHandler<TaskMessageEventArgs>) support cancellation. Does this mean that I should set the Cancel argument to true from within these events? If I understand correctly, they are triggered whenever there is a change in status (which may be a problem when progress stays on 95% for most of the time)? Or is there any way I can directly trigger the Cancel event for the Populate task?

Thanks for any clues,

Attila Grózli-Nagy

Parents Reply Children
No Data