public async Task GetWikiData()
        {
            // Arrage
            WikiData result = new WikiData();

            result = await _service.GetWikiData("Jack Dorsey");

            Console.WriteLine(result);
            Assert.Pass();
        }
示例#2
0
        /// <summary>
        /// Method allowing to generate a search result
        /// </summary>
        public async Task GenerateSearchResult(string searchInput)
        {
            // Clear the result
            this.IsResultAvailable = false;
            //HomePage page = (HomePage)App.Current.MainPage;

            // Animation
            //
            // search bar disappearance
            await Page.FadeSearchBar(true);

            //
            //double width = Convert.ToDouble(Page.Resources["searchbarWidth"]);
            //double height = Convert.ToDouble(Page.Resources["searchbarHeight"]);

            // Annimation forward
            Page.AnimateWidthSearchBar(_width, _height);

            // Set the subtitle
            Subtitle = subtitleLoading;

            // Set the loading status as true
            IsLoading = true;

            // Verify if the input is not null
            if (!string.IsNullOrEmpty(searchInput))
            {
                // Define a new Data result
                DataResult dataResult = new DataResult(await _service.GetWikiData(WkeToolbox.FiltringInputSearch(searchInput)));


                if (dataResult.Wikidata is null)
                {
                    Subtitle = subtitleDataNotFound;
                }
                else
                {
                    // Get the search result after building it
                    SearchResult = dataResult.BuildResult();

                    // Set the Default subtitle
                    Subtitle = subtitleResult;

                    // Set the result as available
                    IsResultAvailable = true;

                    //
                    IsResultSomebody = true;
                }
            }
            else
            {
                // Set the subtitle
                Subtitle = subtitleDefault;
            }

            // Set the loading status as false
            IsLoading = false;


            // Do we get a result?
            if (IsResultAvailable)
            {
                // Annimation backward
                Page.AnimateSearchBar(_height, _width, _height, /*height +*/ Page.Height);

                // Show result on the page
                Page.RevealingResult();
            }
            else
            {
                Page.AnimateWidthSearchBar(_height, _width);
            }

            // Search bar disappearance
            await Page.FadeSearchBar(false);
        }