Exemplo n.º 1
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            buttonUpdate.Enabled = false;
            textTweet.Enabled    = false;
            checkMedia.Enabled   = false;

            string strTweet = textTweet.Text.Replace("\r", "");

            if (strTweet[0] == 'D')
            {
                string[] astrDMParts = strTweet.Split(new char[] { ' ' }, 3);
                if (astrDMParts.Length == 3 && astrDMParts[0] == "D")
                {
                    TwitterDirectMessageAsync.Send(Global.requestToken, astrDMParts[1], astrDMParts[2], null, TimeSpan.FromSeconds(30), (TwitterAsyncResponse <TwitterDirectMessage> ee) => {
                        if (ee.ResponseObject == null)
                        {
                            TweetFailure(ee.Content);
                            return;
                        }

                        // NOTE: This is not required, as it comes in with streaming. I don't know why. Seriously, what?
                        //InsertDMIn(ee.ResponseObject, ColumnType.DirectMessages);

                        this.Invoke(new Action(delegate
                        {
                            textTweet.Enabled = true;
                            textTweet.Text    = "";
                            textTweet.Focus();

                            buttonUpdate.Enabled = true;
                        }));
                    });
                    return;
                }
            }

            StatusUpdateOptions sup = new StatusUpdateOptions();

            sup.InReplyToStatusId = tw_idInReplyTo;

            if (tw_strMediaFilename != "")
            {
                TwitterStatusAsync.UpdateWithMedia(Global.requestToken, strTweet, tw_strMediaFilename, TimeSpan.FromSeconds(30), UpdateResponse, sup);
            }
            else
            {
                TwitterStatusAsync.Update(Global.requestToken, strTweet, sup, TimeSpan.FromSeconds(30), UpdateResponse);
            }
        }
Exemplo n.º 2
0
        public void DownloadInitialTweets()
        {
            switch (ColType)
            {
            case ColumnType.Timeline: TwitterTimelineAsync.HomeTimeline(Global.requestToken, null, TimeSpan.FromSeconds(30), ProcessTweetsCallback); break;

            case ColumnType.Mentions: TwitterTimelineAsync.Mentions(Global.requestToken, null, TimeSpan.FromSeconds(30), ProcessTweetsCallback); break;

            case ColumnType.DirectMessages: TwitterDirectMessageAsync.DirectMessages(Global.requestToken, null, TimeSpan.FromSeconds(30), ProcessDMCallback); break; // TODO: Get sent DM's too

            case ColumnType.List:
                string[] astrListParse = ListLocation.Split('/');
                TwitterListAsync.GetStatuses(Global.requestToken, astrListParse[0], astrListParse[1], null, TimeSpan.FromSeconds(30), ProcessTweetsCallback);
                break;
            }
        }