Answer the question
In order to leave comments, you need to log in
How to know that a Task has completed its work?
Did I understand correctly that ContinueWith() is executed after the completion of the task?
Is this code correct:
Task.Factory.StartNew(() =>
{
//здесь какой-то наш код
}).ContinueWith((t) => {
//выводим в поток gui сообщение об успешном завершении task'a
result.Text = "saved: 512";
result.ForeColor = System.Drawing.Color.Green;
}, TaskScheduler.FromCurrentSynchronizationContext());
Answer the question
In order to leave comments, you need to log in
Yes, you understood correctly. At first glance, there is no problem in the code (if it is executed from a GUI thread and FromCurrentSynchronizationContext() gives the context of the GUI thread). Is something not working?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question