public async void CheckButton() { while (Checking) { await Application.Current.Dispatcher.Invoke(async delegate { if (Keyboard.IsKeyDown(Key.F2)) { var name = spotifyClient.GetSongTitle(); if (name != null) { var result = await geniusClient.SearchSong(name); } } }); } }