コード例 #1
0
 private void timelineDirectMessageMenuItem_Click(object sender, EventArgs e)
 {
     if (timelineTwitterListView.SelectedIndices.Count > 0 &&
         timelineTwitterListView.Items[timelineTwitterListView.SelectedIndices[0]].Tag is StatusInfomation)
     {
         StatusInfomation status = (StatusInfomation)timelineTwitterListView.Items[timelineTwitterListView.SelectedIndices[0]].Tag;
         doingTextBox.Text = string.Format("D {0} {1}", status.User.ScreenName, doingTextBox.Text);
     }
 }
コード例 #2
0
 private void twitterListView_SelectedIndexChanged(object sender, EventArgs e)
 {
     // リストビューに選択がある場合
     if (timelineTwitterListView.SelectedIndices.Count == 1 && timelineTwitterListView.SelectedIndices[0] < twitterStatuses.Length)
     {
         StatusInfomation status = timelineTwitterListView.Items[timelineTwitterListView.SelectedIndices[0]].Tag as StatusInfomation;
         if (status != null)
         {
             doingInfomationTextLabel.Text = status.User.Name + " / " + status.User.ScreenName + "\r\n" + status.Text;
             twitterIconPictureBox.Image   = twitterAccount.GetProfileLargeImage(status.User.ProfileImageUrl);
         }
     }
     // リストビューに選択がない場合
     else
     {
         doingInfomationTextLabel.Text = string.Empty;
         twitterIconPictureBox.Image   = null;
     }
 }
コード例 #3
0
        /// <summary>
        /// Timelineリストビューに StatusInfomation を追加する
        /// </summary>
        /// <param name="addStatus">表示するステータス情報</param>
        private void AddStatusToListView(StatusInfomation addStatus)
        {
            string date = string.Empty;

            if (DateTime.Today <= addStatus.CreatedAt)
            {
                TimeSpan span = DateTime.Now.Subtract(addStatus.CreatedAt);
                if (0 <= span.Minutes && span.Minutes < 1 && span.Hours == 0)
                {
                    date = string.Format(stringResource.GetString("SecAgo"), span.Seconds.ToString());
                }
                else if (0 <= span.Hours && span.Hours < 1 && span.Days == 0)
                {
                    date = string.Format(stringResource.GetString("MinAgo"), span.Minutes.ToString());
                }
                else
                {
                    date = string.Format(stringResource.GetString("HourAgo"), span.Hours.ToString());
                }
            }
            else
            {
                date = addStatus.CreatedAt.ToString("d", null);
            }

            string[] str = { addStatus.User.Name, addStatus.Text, date };

            ListViewItem item = new ListViewItem(str);

            item.Tag = addStatus;
            if (addStatus.User.ProfileImageUrl != null)
            {
                item.ImageIndex = twitterAccount.GetProfileImageIndex(addStatus.User.ProfileImageUrl);
            }
            timelineTwitterListView.Items.Add(item);
        }