Пример #1
0
        private async Task <string> GetAnimeSynopsisAsync()
        {
            AnimeById anime = new AnimeById();

            // get an anime save the asnwer and return the synopsis
            try
            {
                anime = await AnimeRepository.GetAnimeAsync(random.Next(1000));
            }
            catch
            {
                // if no anime exist for the random id get one from hard coded
                anime = await AnimeRepository.GetAnimeAsync(random.Next(100, 107));
            }
            finally
            {
                // if the synopsis is too short
                if (anime.Data.Attributes.Synopsis.Length < 100)
                {
                    anime = await AnimeRepository.GetAnimeAsync(random.Next(1, 20));
                }

                this.Answer = anime.Data.Attributes.Titles.EnJp;

                // Create a btn with the answer as txt
                this.buttons.Add(createbtn(anime.Data.Attributes.Titles.EnJp, Color.Transparent, Color.Red));
            }

            return(anime.Data.Attributes.Synopsis);
        }