I have this class:

```
public class CursorWait : IDisposable
{
    private readonly CancellationTokenSource _tokenSource;

    public CursorWait(int showAfter)
    {
        _tokenSource = new CancellationTokenSource();
        Task.Delay(showAfter, _tokenSource.Token).ContinueWith(delegate(Task task)
        {
            if (!task.IsCanceled)
                Mouse.SetCursor(Cursors.Wait);
        });
    }

    public void Dispose()
    {
        _tokenSource.Cancel();
        Mouse.SetCursor(Cursors.Arrow);
    }
}

```

To use it like this :

```
using (new CursorWait(showAfter: 500))
{
    DoSomethingMayBeHeavyOrNotInUI(); 
}

```

However is not working since the Mouse.SetCursor relies in the UI thread to change it, and since it is busy, it will never change, so how can I change the cursor ? 

**Note**: I know I should not be blocking the UI thread and instead just changing the property IsHitTestVisible of the window. but I'm new at this project and my team made the things this way, and they won't let me since the project is almost finished