private void ListItemDeleteButtonClick(object sender, EventArgs e) { Button thisDeleteButton = (Button)sender; MessageListItem listItem = (MessageListItem)thisDeleteButton.Parent; string conversationID = listItem.ConversationID; doAction.deleteConversation(conversationID); for (int i = 0; i < ConversationFlowPanel.Controls.Count; i++) { if (ConversationFlowPanel.Controls[i].GetType() == typeof(ConversationItem)) { ConversationItem item = (ConversationItem)ConversationFlowPanel.Controls[i]; item.Hide(); item.Dispose(); } else { NewMessageItem item = (NewMessageItem)ConversationFlowPanel.Controls[i]; item.Hide(); item.Dispose(); } } }
private void MessageListItemClick(object sender, EventArgs e) { Console.WriteLine("Messageclick"); MessageListItem thisMessageItem = (MessageListItem)sender; _conversationID = thisMessageItem.ConversationID; Console.WriteLine("This covo id is " + _conversationID); MessageTitleLabel.Text = thisMessageItem.Subject; PopulateMessageConversation(_conversationID); }
private void MessageListItemContentClick(object sender, EventArgs e) { Console.WriteLine("Messageclick"); Label thisLabel = (Label)sender; MessageListItem thisMessageItem = (MessageListItem)thisLabel.Parent; _conversationID = thisMessageItem.ConversationID; Console.WriteLine("This covo id is " + _conversationID); if (!String.IsNullOrWhiteSpace(thisMessageItem.Subject)) { MessageTitleLabel.Text = thisMessageItem.Subject; } else { MessageTitleLabel.Text = "No Subject"; } PopulateMessageConversation(_conversationID); }
private void PopulateMessages(DataTable input) { messageListFlowPanel.Controls.Clear(); for (int i = input.Rows.Count - 1; i >= 0; i--) { MessageListItem messageListItem = new MessageListItem { SenderName = (String)input.Rows[i]["SenderName"], Subject = (String)input.Rows[i]["MessageTitle"], MessageContent = (String)input.Rows[i]["MessageContent"], ReadOrNotRead = (String)input.Rows[i]["ReadOrNotRead"], ConversationID = (String)input.Rows[i]["ConversationID"], Width = messageListFlowPanel.Width - 40 }; if (TypeLabel.Text == "Drafts" || TypeLabel.Text == "Sent") { messageListItem.SenderName = (String)input.Rows[i]["RecipientName"]; } messageListItem.MouseClick += new MouseEventHandler(MessageListItemClick); messageListItem.SubjectLabel.MouseClick += new MouseEventHandler(MessageListItemContentClick); messageListItem.SenderLabel.MouseClick += new MouseEventHandler(MessageListItemContentClick); messageListItem.ContentLabel.MouseClick += new MouseEventHandler(MessageListItemContentClick); messageListItem.DeleteMessageButton.Click += new EventHandler(ListItemDeleteButtonClick); if (messageListFlowPanel.Controls.Count < 0) { messageListFlowPanel.Controls.Clear(); } else { messageListFlowPanel.Controls.Add(messageListItem); } } }