protected void Account_UserStream_Receive(object sender, JsonDocument jdData, UserStream.ReceiveType rtRcvType)
        {
            switch (rtRcvType)
            {
                case UserStream.ReceiveType.Tweet:
                case UserStream.ReceiveType.Reply:
                    Status stNewTweet = new Status(jdData.Root.ToNode());

                    if (!m_twController.ActiveAccount.Statuses.Contains(stNewTweet))
                    {
                        m_twController.ActiveAccount.Statuses.Add(stNewTweet);

                        if (rtRcvType == UserStream.ReceiveType.Tweet)
                            OnTweetReceived(stNewTweet);
                        else
                            OnReplyReceived(stNewTweet);
                    }

                    break;

                case UserStream.ReceiveType.DirectMessage:
                    DirectMessage dmNewMessage = new DirectMessage(jdData.Root.ToNode());
                    m_twController.ActiveAccount.DirectMessages.Add(dmNewMessage);
                    OnDirectMessageReceived(dmNewMessage);
                    break;
            }
        }
Example #2
0
        private void NotifiToast(Status status)
        {
            var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText04);

            var pictureNodes = toastXml.GetElementsByTagName("image");
            ((XmlElement)pictureNodes[0]).SetAttribute("src", status.user.profile_image_url);
            ((XmlElement)pictureNodes[0]).SetAttribute("alt", "user profile pict");

            var textNodes = toastXml.GetElementsByTagName("text");
            textNodes[0].AppendChild(toastXml.CreateTextNode(status.user.name));
            textNodes[1].AppendChild(toastXml.CreateTextNode(status.text));

            var toast = new ToastNotification(toastXml);
            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }
Example #3
0
        /// <summary>
        /// ステータスが公式リツイートであるかどうかを判定し、
        /// 公式リツイートだった場合はリスト表示に適した形に書き換えます。
        /// それ以外の場合はそのままの形を返します。
        /// </summary>
        /// <param name="tempStatus">被判定ステータス</param>
        /// <returns></returns>
        private static Status ConvertRetweet(Status tempStatus)
        {
            var retweetedStatus = tempStatus.retweeted_status;
            retweetedStatus.isretweeted = true;
            retweetedStatus.retweeted_by = tempStatus.user.name;

            return retweetedStatus;
        }
Example #4
0
        private void tmlTimeline_StatusTextClicked(object sender, Status stStatus, StatusTextElement stElement)
        {
            switch (stElement.Type)
            {
                case StatusTextElement.StatusTextElementType.URL:
                    //open browser - let the windows shell handle it
                    System.Diagnostics.Process.Start(stElement.Text);
                    break;

                case StatusTextElement.StatusTextElementType.Hashtag:
                    //show the view for that hashtag
                    break;

                case StatusTextElement.StatusTextElementType.ScreenName:
                    //show the view for that screen name
                    break;
            }
        }
Example #5
0
 protected override void OnReplyReceived(Status stReceived)
 {
     tmlReplyTimeline.Push(stReceived, Accounts.ActiveAccount.BasicAPI);
     UpdateScrollBar();
     OnResize(EventArgs.Empty);
 }
Example #6
0
        private void tmlTimeline_RetweetClicked(object sender, TimelineStatus tsControl, Status stStatus)
        {
            DialogResult drAnswer = MessageBox.Show("Retweet to your followers?\n\n" + stStatus["text"], "Retweet", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (drAnswer == System.Windows.Forms.DialogResult.Yes)
                Accounts.ActiveAccount.BasicAPI.Retweet(RetweetCallback, null, stStatus["id"].ToString());
        }
Example #7
0
 private void tmlTimeline_FavoriteClicked(object sender, TimelineStatus tsControl, Status stStatus)
 {
     if (tsControl.Favorite)
         Accounts.ActiveAccount.BasicAPI.CreateFavorite(FavoriteCreateCallback, null, stStatus["id"].ToString());
     else
         Accounts.ActiveAccount.BasicAPI.DestroyFavorite(FavoriteDestroyCallback, null, stStatus["id"].ToString());
 }
Example #8
0
 private void tmlTimeline_QuoteTweetClicked(object sender, TimelineStatus tsControl, Status stStatus)
 {
     m_ftTweetForm.Avatar = m_twController.ActiveAccount.Avatar;
     m_ftTweetForm.ShowDialog("\"@" + stStatus.User["screen_name"].ToString() + ": " + stStatus["text"].ToString() + "\"");
 }
 protected virtual void OnReplyReceived(Status stReceived) { }
 protected virtual void OnTweetReceived(Status stReceived) { }