private void SearchData(string Name) { PART_DataLoad.Visibility = Visibility.Visible; PART_Data.IsEnabled = false; ButtonSelect.IsEnabled = false; string GameSearch = Name; Task task = Task.Run(() => { SteamGridDbSearchResultData DataSearch = null; try { DataSearch = steamGridDbApi.SearchGame(GameSearch); } catch (Exception ex) { Common.LogError(ex, false, true, "BackgroundChanger"); } this.Dispatcher.BeginInvoke((Action) delegate { PART_SearchList.ItemsSource = null; PART_ElementList.ItemsSource = null; if (DataSearch != null) { PART_SearchList.ItemsSource = DataSearch.data; } PART_DataLoad.Visibility = Visibility.Collapsed; PART_Data.IsEnabled = true; }); }); }
public SteamGridDbSearchResultData SearchGame(string Name) { try { string Response = DownloadStringData(string.Format(UrlSearch, WebUtility.UrlEncode(Name))).GetAwaiter().GetResult(); SteamGridDbSearchResultData ResultData = Serialization.FromJson <SteamGridDbSearchResultData>(Response); return(ResultData); } catch (Exception ex) { Common.LogError(ex, false, true, "BackgroundChanger"); } return(null); }