Use InvokeAsync instead of half-deprecated BeginInvoke.