private async void KeyDownExecute(KeyRoutedEventArgs e) { if (e.Key != VirtualKey.Enter) { return; } _tracksResponse = null; // Close the keyboard ((Page)((Grid)((TextBox)e.OriginalSource).Parent).Parent).Focus(FocusState.Keyboard); var term = ((TextBox)e.OriginalSource).Text; term = term.Trim(); if (term.StartsWith("http://www.last.fm/music/") && term.Contains("/_/")) { CurtainPrompt.Show("Last.fm link detected."); term = term.Replace("http://www.last.fm/music/", string.Empty); var artist = term.Substring(0, term.IndexOf("/_/")); var title = WebUtility.UrlDecode(term.Replace(artist + "/_/", string.Empty)); artist = WebUtility.UrlDecode(artist); try { var track = await _service.GetDetailTrack(title, artist); if (track == null) { CurtainPrompt.ShowError("AppNetworkIssue".FromLanguageResource()); } else { await CollectionHelper.SaveTrackAsync(track); } } catch { CurtainPrompt.ShowError("AppNetworkIssue".FromLanguageResource()); } } else { ((TextBox)e.OriginalSource).IsEnabled = false; IsLoading = true; await SearchAsync(term); ((TextBox)e.OriginalSource).IsEnabled = true; IsLoading = false; } }