Example #1
0
        private async Task SetFocusedCard(int cardId, ArtType artType, Language language)
        {
            string artUrl = await m_client.GetCardArtUrlAsync(cardId, artType, language);

            if (string.IsNullOrEmpty(artUrl))
            {
                img_lastClickedCard.Source = null;
            }
            else
            {
                img_lastClickedCard.Source = GetImageFromUrl(artUrl);
            }
        }
Example #2
0
        private async System.Threading.Tasks.Task LoadHeroUrl(string heroName, int heroIndex)
        {
            bool isInvalid = false;

            if (string.IsNullOrEmpty(heroName) || heroName == "0")
            {
                isInvalid = true;
            }

            string url = await m_client.GetCardArtUrlAsync(heroName, ArtType.Ingame);

            if (string.IsNullOrEmpty(url))
            {
                Logger.OutputError($"Cannot find URL for '{heroName}'");
            }

            if (Heroes == null)
            {
                Heroes = new List <string>();
            }

            string blankHeroImgPath = "/Images/unknown_hero.png";

            if (Heroes.Count - 1 > heroIndex)
            {
                if (isInvalid)
                {
                    Heroes.Insert(heroIndex, blankHeroImgPath);
                }
                else
                {
                    Heroes.Insert(heroIndex, url);
                }
            }
            else
            {
                if (isInvalid)
                {
                    Heroes.Add(blankHeroImgPath);
                }
                else
                {
                    Heroes.Add(url);
                }
            }
        }