Exemple #1
0
        public override void SetupEvent()
        {
            TwitterConnector twitterConnector = this.InParameters["twitter"].GetValue() as TwitterConnector;

            this.stream = twitterConnector.Client.Streams.CreateFilteredStream();
            stream.MatchingTweetReceived += Stream_MatchingTweetReceived;

            var twitterUser = twitterConnector.Client.Users.GetUserAsync(this.InParameters["user"].GetValue().ToString());

            twitterUser.Wait();
            stream.AddFollow(twitterUser.Result);

            stream.StartMatchingAllConditionsAsync();
        }
        public override bool OnExecution()
        {
            try
            {
                TwitterConnector twitterConnector = this.InParameters["twitter"].GetValue() as TwitterConnector;
                twitterConnector.Client.Tweets.PublishTweetAsync(this.InParameters["message"].GetValue().ToString()).Wait();
            }
            catch (Exception ex)
            {
                if (this.CurrentTraceItem != null)
                {
                    this.CurrentTraceItem.ExecutionException = ex;
                }
            }

            return(true);
        }