async Task ExecuteSearchCommand(string searchParameter)
        {
            if (string.IsNullOrEmpty(searchParameter))
            {
                return;
            }

            IsBusy = true;

            try
            {
                Items.RemoveAll(n => true);
                var result = await YouTubeWebsite.SearchVideosAsync(searchParameter, 1);

                Items.AddRange(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #2
0
        async Task ExecuteSearchCommand(string searchParameter)
        {
            if (string.IsNullOrEmpty(searchParameter))
            {
                return;
            }

            IsBusy = true;

            try
            {
                Items.RemoveAll(n => true);
                var results = await YouTubeWebsite.SearchVideosAsync(searchParameter, 1);

                var distinctResults = results.DistinctBy(n => n.Author);
                foreach (var vid in distinctResults)
                {
                    var channel = await YouTubeWebsite.GetVideoAuthorChannelAsync(vid.Id);

                    Items.Add(channel);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }