private void StreamClient_StreamDataReceivedEvent(object sender, EventArgs e) { // convert to dto and model SampledStreamClient.TweetReceivedEventArgs eventArgs = e as SampledStreamClient.TweetReceivedEventArgs; SampledDTOStream resultsDTO = JsonConvert.DeserializeObject<SampledDTOStream>(eventArgs.StreamDataResponse); SampledStream model = _iMapper.Map<SampledDTOStream, SampledStream>(resultsDTO); // raise event with Model OnDataReceivedEvent(new DataReceivedEventArgs { StreamDataResponse = model }); }
public async IAsyncEnumerable <Models.Statistics> AnalyzeTwitterStream() { List <Models.Shared.Emoji> emojis = await Shared.Emojis.GetEmojiLibraryAsync(); Authentication authentication = new Authentication(); await authentication.TokenAsync(); SampledStream sampledStream = new SampledStream(); Models.Statistics statistics = new Models.Statistics(); Shared.Twitter twitter = new Shared.Twitter(); await foreach (Models.TwitterApi.Tweet tweet in sampledStream.GetSampledStreamAsync(authentication.Token)) { if (tweet != null) { twitter.ProcessTweet(tweet, emojis, statistics); yield return(statistics); } } }
private static void StreamService_DataReceivedEvent(object sender, EventArgs e) { SampledStreamService.DataReceivedEventArgs eventArgs = e as SampledStreamService.DataReceivedEventArgs; SampledStream model = eventArgs.StreamDataResponse; }