public async Task UpdateStatisticsAsync() { try { await Task.Run(() => { Total = Tweets.Count; if (Total > 0) { AvgTweetRates = TweetsFilter.GetAverageTweetRates(UpdatesStartedAt, Total); PercentTweetsWithEmoji = TweetsFilter.GetPercentTweetsWithEmoji(TweetsWithEmoji, Total); PercentTweetsWithPhotoUrls = TweetsFilter.GetPercentTweetsWithPhotoUrls(TweetsWithPhotoUrls, Total); PercentTweetsWithUrls = TweetsFilter.GetPercentTweetsWithUrls(TweetsWithUrls, Total); TopDomains = TweetsFilter.GetTopDomains(AllUrls); TopEmoji = TweetsFilter.GetTopEmoji(AllEmoji); TopHashtags = TweetsFilter.GetTopHashtags(AllHashtags); } }); } catch (Exception ex) { Console.WriteLine("[TWEET STATISTICS SERVICE][EXCPETION][UpdateStatisticsAsync]"); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } }
public TweetStatisticsService() { AllEmoji = new List <string>(); AllHashtags = new List <string>(); AllUrls = new List <string>(); AvgTweetRates = new TweetRates(); TopDomains = new List <string>(); TopEmoji = new List <string>(); TopHashtags = new List <string>(); Tweets = new List <Tweet>(); TweetsWithEmoji = new List <Tweet>(); TweetsWithPhotoUrls = new List <Tweet>(); TweetsWithUrls = new List <Tweet>(); UpdatesStartedAt = DateTime.Now; }