private void TryRaiseTweetFavoritedEvents(string eventName, JObject jsonObjectEvent) { var json = jsonObjectEvent.ToString(); var favoriteTweetEvent = jsonObjectEvent[eventName]; var FavoritedTweetEventJson = favoriteTweetEvent.ToString(); var favoriteEventDTOs = _jsonObjectConverter.Deserialize <AccountActivityFavoriteEventDTO[]>(FavoritedTweetEventJson); favoriteEventDTOs.ForEach(favoriteEventDTO => { var tweet = _factories.CreateTweet(favoriteEventDTO.FavoritedTweet); var user = _factories.CreateUser(favoriteEventDTO.User); var accountActivityEvent = new AccountActivityEvent <Tuple <ITweet, IUser> >(new Tuple <ITweet, IUser>(tweet, user)) { AccountUserId = AccountUserId, EventDate = tweet.CreatedAt, Json = json }; var eventArgs = new TweetFavoritedEvent(accountActivityEvent); this.Raise(TweetFavorited, eventArgs); if (eventArgs.InResultOf == TweetFavoritedRaisedInResultOf.Unknown) { this.Raise(EventKnownButNotFullySupportedReceived, new EventKnownButNotSupported(json, eventArgs)); } }); }
private void TweetFavorited(object sender, TweetFavoritedEvent e) { Console.WriteLine($">>> Tweet has been Favorited by {e.FavoritedBy}:\n{e.Tweet}"); }