private void lsMessage_DrawItem(object sender, DrawItemEventArgs e) { Twitterizer.TwitterDirectMessage message = lsMessage.Items[e.Index] as Twitterizer.TwitterDirectMessage; bool b1 = (message.SenderScreenName == CurrentScreenName); if (b1) { e.Graphics.FillRectangle(new SolidBrush(Color.White), e.Bounds); StringFormat sFormat = new StringFormat(); sFormat.Alignment = StringAlignment.Far; e.Graphics.DrawString(message.SenderScreenName, new Font(this.Font.FontFamily, 10, FontStyle.Bold), new SolidBrush(Color.Gray), new PointF(e.Bounds.Right, e.Bounds.Top), sFormat); e.Graphics.DrawString(message.Text, new Font(this.Font.FontFamily, 9, FontStyle.Italic), new SolidBrush(Color.Gray), new RectangleF(e.Bounds.Left, e.Bounds.Top + 18, e.Bounds.Width, 40), sFormat); e.Graphics.DrawString(message.CreatedDate.ToLongDateString(), new Font(this.Font.FontFamily, 8, FontStyle.Bold), new SolidBrush(Color.Gray), new PointF(e.Bounds.Right, e.Bounds.Bottom - 15), sFormat); e.Graphics.DrawLine(new Pen(Color.Gray, 2), new Point(e.Bounds.Left, e.Bounds.Bottom - 1), new Point(e.Bounds.Right, e.Bounds.Bottom - 1)); } else { e.Graphics.FillRectangle(new SolidBrush(Color.WhiteSmoke), e.Bounds); e.Graphics.DrawString(message.SenderScreenName, new Font(this.Font.FontFamily, 10, FontStyle.Bold), new SolidBrush(Color.Black), new PointF(e.Bounds.Left , e.Bounds.Top)); e.Graphics.DrawString(message.Text, new Font(this.Font.FontFamily, 9, FontStyle.Italic), new SolidBrush(Color.Black), new RectangleF(e.Bounds.Left, e.Bounds.Top + 18, e.Bounds.Width, 40)); e.Graphics.DrawString(message.CreatedDate.ToLongDateString(), new Font(this.Font.FontFamily, 8, FontStyle.Bold), new SolidBrush(Color.Black), new PointF(e.Bounds.Left, e.Bounds.Bottom - 15)); e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(e.Bounds.Left, e.Bounds.Bottom - 1), new Point(e.Bounds.Right, e.Bounds.Bottom - 1)); } }
public void InsertDM(FlowLayoutPanel panel, TwitterDirectMessage dm) { this.Invoke(new Action(delegate { // insert new DM in list TweetControl tc = new TweetControl(); Global.DownloadImageToPictureBox(tc.picAvatar, dm.Sender.ProfileImageSecureLocation, this); tc.labelFollowers.Text = dm.Sender.NumberOfFollowers.Value.ToString(); tc.labelName.Text = dm.Sender.ScreenName; tc.labelDate.Text = FormatDate(dm.CreatedDate); tc.labelVia.Text = "via Direct Message"; tc.labelInReplyTo.Text = ""; //tc.labelText.Text = dm.Text; tc.rtText.Text = dm.Text; FindAlternativeLinks(tc.rtText); tc.Width = panel.Width - 8 - panel.Padding.Right; tc.DM = dm; panel.Controls.Add(tc); panel.Controls.SetChildIndex(tc, 0); // limit amount of tweets in list if (panel.Controls.Count > 100) { // delete anything after 100 for (int i = 101; i < panel.Controls.Count; i++) { panel.Controls.RemoveAt(101); // index should always be 101... o___o // this loop looks weird. } } })); }
public void InsertDMIn(TwitterDirectMessage dm, ColumnType colType) { for (int i = 0; i < flowColumns.Controls.Count; i++) { ColumnControl cc = (ColumnControl)flowColumns.Controls[i]; if (cc.ColType == colType) { cc.InsertDM(cc.flowColumn, dm); } } }
public DMElement(MainWindow1 prnt, TwitterDirectMessage status, UserDatabase.User usr, ImageSource Imagesource, bool MoreThanOneUser = false) { InitializeComponent(); dbUser = usr; moreusers = MoreThanOneUser; name = status.Sender.ScreenName; tweetImg.Source = Imagesource; ID = status.Id.ToString(); Status = status; parent = prnt; SolidColorBrush gBrush = new SolidColorBrush(Color.FromArgb((byte)(polyOpacity * 255), 0, 0, 0)); messagePolygon.Fill = gBrush; }
public DMElement(dynamic prnt, TwitterDirectMessage DM, UserDatabase.User usr) { InitializeComponent(); dbUser = usr; Tweet = DM.Text; name = DM.Sender.ScreenName; Date = DM.CreatedDate.Month.ToString() + "/" + DM.CreatedDate.Day.ToString() + " " + DM.CreatedDate.Hour.ToString() + ":" + DM.CreatedDate.Minute.ToString(); imagelocation = DM.Sender.ProfileImageLocation; ID = DM.Id.ToString(); DirectMessage = DM; TweetBlock.Text = Tweet; datelabel.Text = Date; parent = prnt; SolidColorBrush gBrush = new SolidColorBrush(Color.FromArgb((byte)(polyOpacity*255),0,0,0)); messagePolygon.Fill = gBrush; }
public TwitterMessageBuilder Append(TwitterDirectMessage status, ContactModel sender, bool isHighlight) { if (status == null) { throw new ArgumentNullException("status"); } if (sender == null) { throw new ArgumentNullException("sender"); } // MessageModel serializer expects UTC values TimeStamp = status.CreatedDate.ToUniversalTime(); AppendSenderPrefix(sender, isHighlight); AppendMessage(status.Text); return this; }
void DMcreatedCallback(TwitterDirectMessage incomingDM) { if(DMReceived != null) DMReceived(incomingDM, privOAuth); }
static void NewDirectMessage(TwitterDirectMessage message) { Console.WriteLine(string.Format("New message from {0}", message.SenderScreenName)); }
internal void OnDirectedMessageCreated(TwitterDirectMessage directMessage) { if (DirectMessageCreated != null) { DirectMessageCreated(directMessage); } }
private void DirectMessageCreated(TwitterDirectMessage status) { }
// PLZ CHECK IF WORK void o3o_NewDM(TwitterDirectMessage DM, UserDatabase.User _usr) { DMElement element; if (UsrDB.Users.Count > 1) { element = new DMElement(this, DM, _usr, ImageCache.GetImage(DM.Sender.Id, DM.Sender.ProfileImageLocation), true); } else { element = new DMElement(this, DM, _usr, ImageCache.GetImage(DM.Sender.Id, DM.Sender.ProfileImageLocation)); } element.polyOpacity = polygonOpacity; this.TweetMessages.Items.Add(element); if (this.TweetMessages.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay) { TweetElement el = (TweetElement)this.TweetMessages.Items[this.TweetMessages.Items.Count - 1]; this.TweetMessages.Items.Remove(el); el.Dispose(); } }
public void DMreply(TwitterDirectMessage Status) { Process.Start("https://twitter.com/messages"); }
public void SendMessage(string toUser, string message) { TwitterDirectMessage mess = new TwitterDirectMessage(); TwitterDirectMessage.Send(tokens,decimal.Parse(toUser), message); }
protected virtual void Dispose(bool disposing) { if (disposing) { AtNameLabel = null; datelabel = null; replyBtn = null; TweetBlock = null; tweetImg = null; contextmenu = null; dbUser = null; ID = null; imageborder = null; label1 = null; messagePolygon = null; name = null; NameLabel = null; parent = null; polyOpacity = 0; replyBtn = null; replyimageborder = null; Status = null; tweetelementgrid = null; DM_Element = null; } }
private void AppendMessage(TwitterDirectMessage r) { int count = DirectMessages.Count(m=>m.Id == r.Id); //存在しない場合追加する if (count == 0) { //並び替え(ID順に並び替える) for (int i = 0; i < DirectMessages.Count(); i++) { var cur = DirectMessages[i]; if (cur.Id <= r.Id) { DirectMessages.Insert(i, r); return; } } DirectMessages.Add(r); //for (int i = DirectMessages.Count(); i > 40; i--) //{ // DirectMessages.RemoveAt(i - 1); //} } }
// PLZ CHECK IF WORK void o3o_NewDM(TwitterDirectMessage DM, UserDatabase.User _usr) { DMElement element = new DMElement(Mainwindow, DM, _usr); element.polyOpacity = polygonOpacity; Mainwindow.TweetMessages.Items.Add(element); if (Mainwindow.TweetMessages.Items.Count > o3o.Properties.Settings.Default.amountOfTWeetsToDisplay) { Mainwindow.TweetMessages.Items.RemoveAt(Mainwindow.TweetElements.Items.Count); } }
private void NewDirectMessage(TwitterDirectMessage direct_message) { }
private void MessageC(Twitterizer.TwitterDirectMessage status) { this.Messages.Add(status); lsMessage.DataSource = this.Messages; }