コード例 #1
0
ファイル: Timeline.cs プロジェクト: camertron/twitter-windows
        public void Push(Status stToAdd, BasicAPI bAPI)
        {
            TimelineStatus tsNewStatus = new TimelineStatus(stToAdd, bAPI);
            TimelineStatus tsOldTop = null;

            DisableLoadingAnimation();

            if (m_stsControls.Count > 0)
                tsOldTop = m_stsControls.Peek();

            this.Controls.Add(tsNewStatus);
            m_stsControls.Push(tsNewStatus);
            tsNewStatus.UpdateLayout();
            tsNewStatus.BackColor = this.BackColor;
            HookupStatusEvents(tsNewStatus);

            m_iTotalControlHeight += tsNewStatus.Height;
            OnResize(EventArgs.Empty);

            if (m_bScrolledToTop)
            {
                if (tsOldTop != null)
                    tsNewStatus.Top = tsOldTop.Top - tsNewStatus.Height;
                else
                    tsNewStatus.Top = -(tsNewStatus.Height);
            }
            else
            {
                tsNewStatus.Top = 0;
                this.Top -= tsNewStatus.Height;
            }

            tsNewStatus.Visible = true;
            UpdateLayout();
        }
コード例 #2
0
        public TimelineStatus(Status stFrom, BasicAPI bAPI)
        {
            InitializeComponent();

            m_bAPI = bAPI;
            m_bDisplayConversationButton = false;
            m_fntScreenNameFont = new Font("Arial", 10);
            m_fntRetweetedFont = new Font("Arial", 8);
            m_fntFromUser = new Font("Arial", 10, FontStyle.Bold);
            m_sbFromUser = new SolidBrush(Color.Black);
            m_sbRetweet = new SolidBrush(Color.FromArgb(70, 70, 70));
            m_pnBorderPen = new Pen(Color.FromArgb(220, 220, 220));

            m_stStatusObj = stFrom;
            ttfTextField.UpdateFromStatus(m_stStatusObj);
            Favorite = Boolean.Parse(m_stStatusObj["favorited"].ToString());

            if (m_stStatusObj.IsRetweet)
            {
                if (m_stStatusObj.RetweetedStatus == null)
                {
                    if ((m_stStatusObj.StatusText.Words.Count > 1) && (m_stStatusObj.StatusText.Words[1].Type == StatusTextElement.StatusTextElementType.ScreenName))
                    {
                        m_sFromUser = m_stStatusObj.StatusText.Words[1].Text.Substring(1);
                        new Thread(new ThreadStart(UserLookup)).Start();
                    }
                }
                else
                {
                    m_sFromUser = m_stStatusObj.RetweetedStatus.User["screen_name"].ToString();
                    AsyncContentManager.GetManager().RequestImage(m_stStatusObj.RetweetedStatus.User["profile_image_url"].ToString(), AvatarCallback);
                }
            }
            else
            {
                m_sFromUser = m_stStatusObj.User["screen_name"].ToString();
                AsyncContentManager.GetManager().RequestImage(m_stStatusObj.User["profile_image_url"].ToString(), AvatarCallback);
            }

            User uActiveUser = TwitterController.GetController().ActiveAccount.UserObject;

            if (uActiveUser != null)
                Retweet = m_stStatusObj.IsRetweet && (m_sFromUser == TwitterController.GetController().ActiveAccount.UserObject["screen_name"].ToString());

            ttfTextField.TextElementClicked += new TweetTextField.TextElementClickHandler(ttfTextField_TextElementClicked);

            abRetweet.Click += new EventHandler(abRetweet_Click);
            abFavorite.Click += new EventHandler(abFavorite_Click);
            abReply.Click += new EventHandler(abReply_Click);
            abConversation.Click += new EventHandler(abConversation_Click);
        }
コード例 #3
0
        public UserStream(OAuthCredentials oaCredentials)
        {
            m_oaCredentials = oaCredentials;
            m_bscAPI = new BasicAPI(m_oaCredentials);

            m_rcClient = new RestClient
            {
                Authority = C_BASE_URL,
                VersionPath = C_VERSION_PATH,
                Credentials = m_oaCredentials,
                Method = WebMethod.Get,
                StreamOptions = new StreamOptions
                {
                    ResultsPerCallback = 1
                }
            };
        }