private void addItem(TrasenMessage.MessageCommunication message) { UCMessageTip ucTip = new UCMessageTip(message); ucTip.Dock = DockStyle.Top; ucTip.Tag = message.MessageId; ucTip.ClickedLinkLabel += new UCMessageTip.OnClickedLinkLabelHandler(ucTip_ClickedLinkLabel); this.plMessageList.Controls.Add(ucTip); }
private void llbAllRead_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { bool cancel = false; List <Guid> lstMsgIds = new List <Guid>(); foreach (Control ctrl in this.plMessageList.Controls) { UCMessageTip tip = ctrl as UCMessageTip; if (tip.Checked) { lstMsgIds.Add(new Guid(tip.Tag.ToString())); } } if (setCheckedMessageStatus != null) { setCheckedMessageStatus(lstMsgIds, Action.SetReaded, ref cancel); } if (cancel) { return; } //移除选中的消息 List <Control> removeControls = new List <Control>(); foreach (Control ctrl in this.plMessageList.Controls) { if ((ctrl as UCMessageTip).Checked) { removeControls.Add(ctrl); } } foreach (Control ctrl in removeControls) { plMessageList.Controls.Remove(ctrl); } if (plMessageList.Controls.Count == 0) { this.Hide(); } }