I am working on a WPF application and I just want to change the cursor before and after the task starts. I have this code:
this.Cursor = Cursors.Wait;
Task.Factory.StartNew(() => PerformMigration(legacyTrackerIds)).ContinueWith(_ => this.Cursor = Cursors.Arrow);
The cursor actually changes to a wait cursor, but when the task is completed, it does not return to the arrow. If I set a breakpoint in the ContinueWith () method, it will hit. But the cursor does not return to the arrow. Why?
It was the old way that I tried it. The cursor has changed to an arrow, but I do not want to wait () for the task.
this.Cursor = Cursors.Wait;
Task.Factory.StartNew(() => PerformMigration(legacyTrackerIds)).Wait();
this.Cursor = Cursors.Arrow;
source
share