Beispiel #1
0
        private void SearchDataElements(int Id)
        {
            PART_DataLoad.Visibility = Visibility.Visible;
            PART_Data.IsEnabled      = false;

            ButtonSelect.IsEnabled = false;

            string GameSearch = SearchElement.Text;
            Task   task       = Task.Run(() =>
            {
                DataSearch = null;
                try
                {
                    DataSearch = steamGridDbApi.SearchElement(Id, steamGridDbType);
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, false, true, "BackgroundChanger");
                }

                this.Dispatcher.BeginInvoke((Action) delegate
                {
                    if (DataSearch != null)
                    {
                        ApplyFilter(null, null);
                    }

                    PART_DataLoad.Visibility = Visibility.Collapsed;
                    PART_Data.IsEnabled      = true;
                });
            });
        }
Beispiel #2
0
        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 SteamGridDbResultData SearchElement(int Id, SteamGridDbType steamGridDbType)
        {
            try
            {
                string Url = UrlSearchHeroes;
                if (steamGridDbType == SteamGridDbType.grids)
                {
                    Url = UrlSearchGrids;
                }

                string Response = DownloadStringData(string.Format(Url, Id)).GetAwaiter().GetResult();
                SteamGridDbResultData ResultData = Serialization.FromJson <SteamGridDbResultData>(Response);
                return(ResultData);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, false, true, "BackgroundChanger");
            }

            return(null);
        }