Make WaitForKey async to ensure it is executed on UI thread. Rename WaitForKey as WaitForKeyAsync.