public ActionResult PostToTwitter(string url, string text)
        {
            if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(text))
                return Json(new { Success = false, Message = "You must enter some text to tweet" });

            IOAuthCredentials credentials = new SessionStateCredentials();

            credentials.ConsumerKey = _config.TwitterConsumerKey;
            credentials.ConsumerSecret = _config.TwitterConsumerSecret;
            credentials.AccessToken = _config.TwitterAccessTokenSecret;
            credentials.OAuthToken = _config.TwitterAccessToken;

            MvcAuthorizer auth = new MvcAuthorizer { Credentials = credentials };

            TwitterContext twitter = new TwitterContext(auth);

            try
            {
                twitter.UpdateStatus(text + " " + url);

                return Json(new { Success = true });
            }
            catch (Exception e)
            {
                return Json(new { Success = false, Message = e.Message });
            }
        }
Esempio n. 2
0
 public static void UpdateStatus(string tweet, IOAuthCredentials credentials) {
     var singleUserAuthorizer = new SingleUserAuthorizer {
         Credentials = credentials
     };
     var twitterCtx = new TwitterContext(singleUserAuthorizer);
     twitterCtx.UpdateStatus(tweet);
 }
        private void BindDemo()
        {
            ITwitterAuthorizer autentikasi = GetInformasiKredensial();

            var TwitterDataContext = new TwitterContext(autentikasi);

            var status = TwitterDataContext.UpdateStatus("Skuad jadi latihan teu?");
        }
Esempio n. 4
0
 public string Tweet(ITwitterAuthorizer auth, string status)
 {
   using (var twitterCtx = new TwitterContext(auth))
   {
     var tweet = twitterCtx.UpdateStatus(status);
     
     return tweet.StatusID;
   }
 } 
Esempio n. 5
0
        private bool Tweet(string action, string subject, string url, string hashTags)
        {
            var message = string.Format("{0} {1}: {2} {3}", action, subject, url, hashTags);

            using (var twitterContext = new TwitterContext(this.authorizer))
            {
                var status = twitterContext.UpdateStatus(message, true);

                return status != null;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// shows what happens when performing a side-effect when ReadOnly is turned on
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void HandleOAuthSideEffectReadOnlyDemo(TwitterContext twitterCtx)
        {
            if (twitterCtx.AuthorizedClient.IsAuthorized)
            {
                var status = twitterCtx.UpdateStatus("I used LINQ to Twitter with OAuth: " + DateTime.Now.ToString());

                Console.WriteLine(
                    "Friend: {0}\nTweet: {1}\n",
                    status.User.Name,
                    status.Text);
            }
        }
Esempio n. 7
0
    protected void postUpdateButton_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        twitterCtx = new TwitterContext(auth);
        twitterCtx.UpdateStatus(updateBox.Text);
        updateBox.Text = string.Empty;
        successLabel.Visible = true;
    }
Esempio n. 8
0
 /// <summary>
 /// Send a new tweet
 /// </summary>
 /// <param name="text"></param>
 internal bool SendTweet(string text)
 {
     try
     {
         _twitterContext.UpdateStatus(text);
         return(true);
     }
     catch (Exception exception)
     {
         RaiseOperationError(exception);
         return(false);
     }
 }
 public JsonResult PostTweet(string tweet)
 {
     Authorize();
     twitterCtx = new TwitterContext(auth);
     try
     {
         twitterCtx.UpdateStatus(tweet);
         return Json(new { success = true });
     }
     catch (Exception ex)
     {
         return Json(new { success = false });
     }
 }
        /// <summary>
        /// Send an answer through twitter with the related question
        /// </summary>
        /// <param name="question"></param>
        /// <param name="answer">The answer given by expert, answer.Content + reference can't be longer then 140 characters</param>
        public void SendAnswer(Question question, Answer answer)
        {
            var reference = question.Source.Source.Value;
            var postId = question.Source.PostId;

            var status = reference + " " + answer.Content;

            validation.StringCheck(postId);
            validation.TweetLengthCheck(status);

            using (TwitterContext twitterCtx = new TwitterContext(PinAutharizedUser))
            {
                var tweet = twitterCtx.UpdateStatus(status, postId);                
            }
        }        
Esempio n. 11
0
 static void Main(string[] args)
 {
     var auth = new SingleUserAuthorizer {
         Credentials = new SingleUserInMemoryCredentials {
             ConsumerKey = args[0],
             ConsumerSecret = args[1],
             TwitterAccessToken = args[2],
             TwitterAccessTokenSecret = args[3]
         }
     };
     auth.Authorize();
     if (!auth.IsAuthorized)
         throw new AuthenticationException();
     var twitterCtx = new TwitterContext(auth);
     twitterCtx.UpdateStatus(args[4]);
 }
Esempio n. 12
0
        public static void tweet(String what)
        {
            XmlNodeList nodes = prepareXML();

            var auth = new SingleUserAuthorizer
            {
                Credentials = new InMemoryCredentials
                {
                    ConsumerKey = nodes.Item(0).InnerText,
                    ConsumerSecret = nodes.Item(1).InnerText,
                    OAuthToken = nodes.Item(2).InnerText,
                    AccessToken = nodes.Item(3).InnerText,
                }
            };

            var service = new TwitterContext(auth);
            var tweet = service.UpdateStatus(what.Trim());
        }
Esempio n. 13
0
        private void TweetButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TweetTextBox.Text))
            {
                MessageBox.Show("Please enter text to tweet.");
            }

            ITwitterAuthorizer auth = SharedState.Authorizer;

            if (auth == null || !auth.IsAuthorized)
            {
                NavigationService.Navigate(new Uri("/OAuth.xaml", UriKind.Relative));
            }
            else
            {
                var twitterCtx = new TwitterContext(auth);

                twitterCtx.UpdateStatus(TweetTextBox.Text,
                    updateResp => Dispatcher.BeginInvoke(() =>
                    {
                        switch (updateResp.Status)
                        {
                            case TwitterErrorStatus.Success:
                                Status tweet = updateResp.State;
                                User user = tweet.User;
                                UserIdentifier id = user.Identifier;
                                MessageBox.Show(
                                    "User: "******", Posted Status: " + tweet.Text,
                                    "Update Successfully Posted.",
                                    MessageBoxButton.OK);
                                break;
                            case TwitterErrorStatus.TwitterApiError:
                            case TwitterErrorStatus.RequestProcessingException:
                                MessageBox.Show(
                                    updateResp.Exception.ToString(),
                                    updateResp.Message,
                                    MessageBoxButton.OK);
                                break;
                        }
                    }));
            }
        }
Esempio n. 14
0
        /// <summary>
        /// shows how to handle a TwitterQueryException with a side-effect
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void HandleSideEffectExceptionDemo(TwitterContext twitterCtx)
        {
            // force the error by supplying bad credentials
            twitterCtx.AuthorizedClient = new UsernamePasswordAuthorization
            {
                UserName = "******",
                Password = "******",
            };

            try
            {
                var status = twitterCtx.UpdateStatus("Test from LINQ to Twitter - 5/2/09");
            }
            catch (TwitterQueryException tqe)
            {
                // log it to the console
                Console.WriteLine(
                    "\nHTTP Error Code: {0}\nError: {1}\nRequest: {2}\n",
                    tqe.HttpError,
                    tqe.Response.Error,
                    tqe.Response.Request);
            }
        }
        public void UpdateStatus_Throws_On_Null_Tweet()
        {
            const string InReplyToStatusID = "184835136037191681";
            var authMock = new Mock<ITwitterAuthorizer>();
            var execMock = new Mock<ITwitterExecute>();
            execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
            execMock.Setup(exec =>
                exec.PostToTwitter(
                    It.IsAny<string>(),
                    It.IsAny<Dictionary<string, string>>(),
                    It.IsAny<Func<string, Status>>()))
                .Returns(SingleStatusResponse);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, "", "");

            var ex = Assert.Throws<ArgumentException>(() => ctx.UpdateStatus(null, InReplyToStatusID));

            Assert.Equal("status", ex.ParamName);
        }
Esempio n. 16
0
        /// <summary>
        /// shows how to update a status
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void UpdateStatusDemo(TwitterContext twitterCtx)
        {
            var status =
                " Testing LINQ to Twitter update status on " +
                DateTime.Now.ToString() + " #linqtotwitter "
                //+
                //@"`!@#$%^&*()_-+=.~,:;'?/|\[] éü\u00C7"
                ;

            Console.WriteLine("\nStatus being sent: \n\n\"{0}\"", status);
            Console.WriteLine("\nPress any key to post tweet...\n");
            Console.ReadKey();

            var tweet = twitterCtx.UpdateStatus(status);

            Console.WriteLine(
                "Status returned: " +
                "(" + tweet.StatusID + ")" +
                "[" + tweet.User.ID + "]" +
                tweet.User.Name + ", " +
                tweet.Text + ", " +
                tweet.CreatedAt + "\n");
        }
Esempio n. 17
0
        /// <summary>
        /// shows how to asynchronously update a status
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void UpdateStatusWithCallbackDemo(TwitterContext twitterCtx)
        {
            //Thread.CurrentThread.CurrentCulture = new CultureInfo("nn-NO");
            //Thread.CurrentThread.CurrentUICulture = new CultureInfo("nn-NO");
            var status =
                " Testing LINQ to Twitter update status on " +
                DateTime.Now.ToString() + " #linqtotwitter "
                //+ @"`!@#$%^&*()_-+=.~,:;'?/|\[] éü\u00C7"
                ;

            Console.WriteLine("\nStatus being sent: \n\n\"{0}\"", status);
            Console.WriteLine("\nPress any key to post tweet...\n");
            Console.ReadKey();

            twitterCtx.UpdateStatus(status,
                response =>
                {
                    if (response.Status == TwitterErrorStatus.Success)
                    {
                        Status tweet = response.State;

                        Console.WriteLine(
                            "Status returned: " +
                            "(" + tweet.StatusID + ")" +
                            "[" + tweet.User.ID + "]" +
                            tweet.User.Name + ", " +
                            tweet.Text + ", " +
                            tweet.CreatedAt + "\n");
                    }
                    else
                    {
                        Console.WriteLine(response.Exception.ToString());
                    }
                });
        }
Esempio n. 18
0
        /// <summary>
        /// shows how to update a status
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void UpdateStatusWithLocationDemo(TwitterContext twitterCtx)
        {
            // the \u00C7 is C Cedilla, which I've included to ensure that non-ascii characters appear properly
            var status = "\u00C7 Testing LINQ to Twitter update status on " + DateTime.Now.ToString() + " £ #linqtotwitter";
            //var status = "あいうえお" + DateTime.Now.ToString();
            string japaneseCultureString = "ja-JP";
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(japaneseCultureString);
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(japaneseCultureString);
            decimal latitude = Decimal.Parse("37.78215", CultureInfo.CurrentUICulture);
            decimal longitude = Decimal.Parse("-122.40060", CultureInfo.CurrentUICulture);

            //decimal latitude = 37.78215m;
            //decimal longitude = -122.40060m;

            Console.WriteLine("Status being sent: " + status);

            var tweet = twitterCtx.UpdateStatus(status, latitude, longitude, true);

            Console.WriteLine(
                "User: {0}, Tweet: {1}\nLatitude: {2}, Longitude: {3}",
                tweet.User.Identifier.ScreenName,
                tweet.Text,
                tweet.Coordinates.Latitude,
                tweet.Coordinates.Longitude);
        }
 public JsonResult Tweet(string tweet)
 {
     Authorize();
     twitterCtx = new TwitterContext(auth);
     try
     {
         Status stat = twitterCtx.UpdateStatus(tweet);
         if (stat != null)
         {
             return Json(new { success = true });
         }
         else
         {
             return Json(new { success = false, errorMessage = "Unknown Error" });
         }
     }
     catch (Exception ex)
     {
         return Json(new { success = false, errorMessage = ex.Message });
     }
 }
        private void SendTweet(string status)
        {
            var singleUserAuthorizer = new SingleUserAuthorizer
            {
                Credentials = new SingleUserInMemoryCredentials
                {
                    ConsumerKey = ConsumerKey,
                    ConsumerSecret = ConsumerSecret,
                    TwitterAccessToken = AccessToken,
                    TwitterAccessTokenSecret = AccessTokenSecret
                }
            };

            using (var twitterContext = new TwitterContext(singleUserAuthorizer))
            {
                try
                {
                    twitterContext.UpdateStatus(status);
                }
                catch (Exception e)
                {
                    var message = string.Format("Unable to tweet log due to {0}", e);
                    Console.Error.WriteLine(message);
                    Trace.WriteLine(message);
                }
            }
        }
Esempio n. 21
0
        /// <summary>
        /// shows how to update a status
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void UpdateStatusWithPlaceDemo(TwitterContext twitterCtx)
        {
            // the \u00C7 is C Cedilla, which I've included to ensure that non-ascii characters appear properly
            var status = "\u00C7 Testing LINQ to Twitter update status on " + DateTime.Now.ToString() + " #linqtotwitter";

            Console.WriteLine("Status being sent: " + status);

            var tweet = twitterCtx.UpdateStatus(status, 37.78215m, -122.40060m, "fbd6d2f5a4e4a15e");

            Console.WriteLine(
                "User: {0}, Tweet: {1}\nLatitude: {2}, Longitude: {3}, Place: {4}",
                tweet.User.Identifier.ScreenName,
                tweet.Text,
                tweet.Coordinates.Latitude,
                tweet.Coordinates.Longitude,
                tweet.Place.Name);
        }
Esempio n. 22
0
        /// <summary>
        /// shows how to update a status
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void UpdateStatusWithReplyDemo(TwitterContext twitterCtx)
        {
            var tweet = twitterCtx.UpdateStatus(
                "@JoeMayo Testing LINQ to Twitter with reply on " + DateTime.Now.ToString() + " #linqtotwitter",
                "249241028782088193");

            Console.WriteLine(
                "(" + tweet.StatusID + ")" +
                "[" + tweet.User.ID + "]" +
                tweet.User.Name + ", " +
                tweet.Text + ", " +
                tweet.CreatedAt);
        }
 internal static Status SendUpdate(string updateText, TweetItem inRepyTo)
 {
     if (_sampleDataSource._auth == null)
     {
         _sampleDataSource.InitGroups();
     }
     using (var twitterCtx = new TwitterContext(_sampleDataSource._auth))
     {
         Status tweet = null;
         if (inRepyTo != null)
         {
             tweet = twitterCtx.UpdateStatus(updateText, true, inRepyTo.UniqueId);
         }
         else
         {
             tweet = twitterCtx.UpdateStatus(updateText, true);
         }
         if (tweet != null && !string.IsNullOrEmpty(tweet.StatusID))
         {
             updateText = string.Empty;
         }
         return tweet;
     }
 }
Esempio n. 24
0
        /// <summary>
        /// shows how to update a status
        /// </summary>
        /// <param name="twitterCtx">TwitterContext</param>
        private static void UpdateStatusDemo(TwitterContext twitterCtx)
        {
            // the \u00C7 is C Cedilla, which I've included to ensure that non-ascii characters appear properly
            var status = "\u00C7 Testing LINQ to Twitter update status on " + DateTime.Now.ToString() + " #linqtotwitter";

            Console.WriteLine("Status being sent: " + status);

            var tweet = twitterCtx.UpdateStatus(status);

            Console.WriteLine(
                "Status returned: " +
                "(" + tweet.StatusID + ")" +
                "[" + tweet.User.ID + "]" +
                tweet.User.Name + ", " +
                tweet.Text + ", " +
                tweet.CreatedAt);
        }
Esempio n. 25
0
    private List<SessionsResult> SessionsToTweetAfterSignup(out StringBuilder sbText)
    {
        //DateTime compareDateTime = DateTime.Now.Subtract(new TimeSpan(0, 1, 0, 0));
        // do a max of 2 at a time.  these go every 30 minutes
        var sessionsToTweet = SessionsManager.I.Get(new SessionsQuery
                                                        {
                                                            TweetLineTweeted = false,
                                                            WithSpeakers = true,
                                                            WithSchedule = true,
                                                            CodeCampYearId = Utils.CurrentCodeCampYear
                                                        }).Where(
                                                            a =>
                                                            a.Createdate != null &&
                                                            a.Createdate.Value.CompareTo(
                                                                DateTime.Now.Subtract(new TimeSpan(0, 48, 0, 0))) <
                                                            0).
            OrderByDescending(a => a.Id).Take(_tweetsToProcessAtOnce).ToList();

        sbText = new StringBuilder();
        foreach (var session in sessionsToTweet)
        {
            var speakers = Utils.GetSpeakersBySessionId(session.Id);
            var sb = new StringBuilder();
            foreach (var speaker in speakers)
            {
                string speakerName = string.Format("{0} {1},", speaker.UserFirstName, speaker.UserLastName);
                sb.Append(speakerName);
            }
            string speakerList = sb.ToString();
            if (speakerList.Length > 0 && speakerList.EndsWith(","))
            {
                speakerList = speakerList.Substring(0, speakerList.Length - 1);
            }

            string sessionUrl = String.Format("http://siliconvalley-codecamp.com/Sessions.aspx?sessionid={0}",
                                              session.Id);
            string sessionUrlShort = API.Bit(_bitLyApiUsername, _bitLyApiKey,
                                             HttpContext.Current.Server.HtmlEncode(sessionUrl), "Shorten");

            string template = "NEW SESSION: {0}  Speaker: {1} #svcc Title: \"{2}\"";
            if (speakerList.Length > 0 && speakers.Count > 1)
            {
                template = "NEW SESSION: {0}  Speakers: {1} #svcc Title: \"{2}\"";
            }

            string tweet = String.Format(template, sessionUrlShort, speakerList, session.Title);
            if (tweet.Length > 139)
            {
                tweet = tweet.Substring(0, 136) + "...";
            }

            // finally, do the tweet
            string credentialString = _twitterCredential;

            var credentials = new SessionStateCredentials();
            credentials.Load(credentialString);

            var auth = new WebAuthorizer
                           {
                               Credentials = credentials
                           };

            var twitterCtx = new TwitterContext(auth);
            const decimal lattitude = (decimal) 37.362056;
            const decimal longitude = (decimal) 122.131056;
            if (!testMode)
            {
                Status tweetInfo = twitterCtx.UpdateStatus(tweet, lattitude, longitude);
                Label1.Text = tweetInfo.Text; // not sure if this helps
            }

            sbText.AppendLine(tweet);

            // update
            session.TweetLine = tweet;
            session.TweetLineTweetedDate = DateTime.Now;
            session.TweetLineTweeted = true;
            if (!testMode)
            {
                SessionsManager.I.Update(session);
            }

            // finally, send the emails.
            foreach (var rec in speakers)
            {
                SendEmailToSpeaker(rec.UserFirstName, rec.UserLastName, rec.Email, session.Title, tweet);
            }
        }
        return sessionsToTweet;
    }
Esempio n. 26
0
    private List<SessionsResult> SessionsToTweetBeforeBigEvent(out StringBuilder sbText)
    {
        var codeCampYearResult = CodeCampYearManager.I.Get(new CodeCampYearQuery {Id = Utils.CurrentCodeCampYear}).FirstOrDefault();
        if (codeCampYearResult != null)
        {
            DateTime startTweetsAfter =
                codeCampYearResult.
                    CampStartDate.Subtract(new TimeSpan(12, 0, 0, 0));

            if (startTweetsAfter.CompareTo(DateTime.Now) > 0)
            {
                sbText = new StringBuilder("No Tweeting because too soon for SessionsToTweetBeforeBigEvent()");
                return new List<SessionsResult>();
            }
        }
        else
        {
            sbText = new StringBuilder("No Tweeting because no code camp year found");
            return new List<SessionsResult>();
        }

        // if got here, then we should start tweeting all sessions again

        var sessionsToTweet =
            SessionsManager.I.Get(new SessionsQuery
                                      {
                                          TweetLineTweetedPreCamp = false,
                                          WithSchedule = true,
                                          WithSpeakers = true,
                                          CodeCampYearId = Utils.CurrentCodeCampYear
                                         // Id = 953 // test for just scottgu and email comes to me
                                      }).Where(a => !a.SessionTime.Equals("Agenda Not Set Yet")).
                                      OrderBy(a => a.SessionTimesResult.StartTime.HasValue ? a.SessionTimesResult.StartTime.Value : DateTime.Now).Take(_tweetsToProcessAtOnce).
                ToList();

        sbText = new StringBuilder();
        foreach (var session in sessionsToTweet)
        {

            DateTime sessionTime;
            string sessionTimeFriendly;
            string speakerNames;
            string speakerHandles;
            string hashTags;
            Utils.GetSessionHandlesHashTagsTime(session, out speakerNames, out speakerHandles,out hashTags, out sessionTime, out sessionTimeFriendly);
            string sessionTitle = Utils.ClearSpecialCharacters(session.Title);

            string sessionUrl = String.Format("http://siliconvalley-codecamp.com/Sessions.aspx?sessionid={0}",
                                              session.Id);
            string sessionUrlShort = API.Bit(_bitLyApiUsername, _bitLyApiKey,
                                             HttpContext.Current.Server.HtmlEncode(sessionUrl), "Shorten");

            // "at 9:45AM 10/6 Speaker Douglas Crockford @dougc Title: Gonads and Ponads  #svcc #json http://dkfjdkf
            string template = "{0}  {1} {2} \"{{0}}\" #svcc {3} {4} ReTweet!";

            string tweetFirstPart =
                String.Format(template, sessionTimeFriendly, speakerNames, speakerHandles, hashTags,
                              sessionUrlShort).Trim();
            int spaceLeftForTitle = 130 - tweetFirstPart.Length;
            int titleLen = Math.Min(sessionTitle.Length, spaceLeftForTitle);

            string tweet = String.Format(tweetFirstPart, sessionTitle.Substring(0, titleLen)).Trim();

            // finally, do the tweet
            string credentialString = _twitterCredential;

            var credentials = new SessionStateCredentials();
            credentials.Load(credentialString);

            var auth = new WebAuthorizer
            {
                Credentials = credentials
            };

            var twitterCtx = new TwitterContext(auth);
            const decimal lattitude = (decimal)37.362056;
            const decimal longitude = (decimal)122.131056;
            if (!testMode)
            {
                Status tweetInfo = twitterCtx.UpdateStatus(tweet, lattitude, longitude);
                Label1.Text = tweetInfo.Text; // not sure if this helps
            }
            sbText.AppendLine(tweet);

            // update
            session.TweetLinePreCamp = tweet;
            session.TweetLineTweetedDatePreCamp = DateTime.Now;
            session.TweetLineTweetedPreCamp = true;

            if (!testMode)
            {
                SessionsManager.I.Update(session);
            }

            // finally, send the emails.
            foreach (var rec in session.SpeakersList)
            {
                SendEmailToSpeakerJustBeforeEvent(rec.UserFirstName, rec.UserLastName, rec.Email, session.Title, tweet);
            }
        }
        return sessionsToTweet;
    }
        public void UpdateStatus_With_Reply_Sets_StatusID()
        {
            const string Status = "Hello";
            const string InReplyToStatusID = "1";
            string expectedStatusID = "184835136037191681";
            var authMock = new Mock<ITwitterAuthorizer>();
            var execMock = new Mock<ITwitterExecute>();
            execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, "", "");
            execMock.Setup(exec => exec.PostToTwitter(It.IsAny<string>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Func<string, Status>>()))
                    .Returns(SingleStatusResponse);

            Status actual = ctx.UpdateStatus(Status, InReplyToStatusID);

            Assert.Equal(expectedStatusID, actual.StatusID);
        }
Esempio n. 28
0
        private void Tweet(string status)
        {
            var auth = new SingleUserAuthorizer
            {
                Credentials = new InMemoryCredentials
                {
                    ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"],
                    ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"],
                    OAuthToken = ConfigurationManager.AppSettings["twitterOAuthToken"],
                    AccessToken = ConfigurationManager.AppSettings["twitterAccessToken"]
                }
            };

            using (var twitterCtx = new TwitterContext(auth))
            {
                twitterCtx.UpdateStatus(status);
            }
        }