private async Task GetYouTubeRefrencesAsync() { await Task.Factory.StartNew(async() => { if (this.YouTubeRefrences.Count != 0 || this.IsBusy) { return; } await System.Windows.Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { this.IsBusy = true; })); List <BaseSearchResult> results = new List <BaseSearchResult>(); var youtubeDataProvider = new YouTubeDataProvider(_fqdn, results, _cancellationToken, true, _domainParser); await youtubeDataProvider.LoadMoreItemsAsync(Int32.MaxValue); var items = results.Where(x => x.Source.Equals("YouTube")); var fdqn = _fqdn.ToLowerInvariant(); foreach (var item in items) { var domain = item.Domains.FirstOrDefault(x => x.Address.ToLowerInvariant().Equals(fdqn)); if (domain != null) { var backRefrence = new YouTubeBackLink(); backRefrence.Source = "YouTube"; backRefrence.SourceAddress = item.SourceAddress; backRefrence.FullAddress = domain.FullAddress; backRefrence.SearchResult = (YouTubeSearchResult)item; await System.Windows.Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { this.YouTubeRefrences.Add(backRefrence); })); } } await System.Windows.Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { this.IsBusy = false; this.IsYouTubeReferencesAvailable = this.YouTubeRefrences.Count > 0 ? true : false; if (this.IsYouTubeReferencesAvailable) { this.IsBackLinkCountVisible = true; this.BackLinkCount = this.YouTubeRefrences.Count.ToString("N0"); TotalVideoViews = YouTubeRefrences.Select(x => x.SearchResult.ViewCount) .Where(x => x.HasValue) .Select(x => x.Value) .Aggregate((x, y) => x + y); } })); }); }