private void EditDraftButtonClick(object sender, EventArgs e) { Button clickedButton = (Button)sender; ConversationItem item = (ConversationItem)clickedButton.Parent; DataTable _messageForID = messageTableAdapter.GetDataByMessageIDNumber(item.MessageID, RecipientID); NewMessageItem draftToEdit = new NewMessageItem(_conversationID, MessageTitleLabel) { Subject = (String)_messageForID.Rows[0]["MessageTitle"], SenderName = (String)_messageForID.Rows[0]["SenderName"], SenderID = (String)_messageForID.Rows[0]["SenderID"], ReceiverName = (String)_messageForID.Rows[0]["RecipientName"], ReceiverID = (String)_messageForID.Rows[0]["RecipientID"], MessageContent = (String)_messageForID.Rows[0]["MessageContent"], Width = ConversationFlowPanel.Width - 10 }; ConversationFlowPanel.Controls.Add(draftToEdit); draftToEdit.Width = ConversationFlowPanel.Width - 10; item.Dispose(); }
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(); } } }