请帮我注释一下下面C#的代码,objShortMessageCollection = objclsSMS.ReadSMS(this.port);foreach (ShortMessage msg in objShortMessageCollection){ListViewItem item = new ListViewItem(new string[] { msg.Index ,msg.Sender,msg.Message });item.Tag
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 16:23:46
请帮我注释一下下面C#的代码,objShortMessageCollection = objclsSMS.ReadSMS(this.port);foreach (ShortMessage msg in objShortMessageCollection){ListViewItem item = new ListViewItem(new string[] { msg.Index ,msg.Sender,msg.Message });item.Tag
请帮我注释一下下面C#的代码,
objShortMessageCollection = objclsSMS.ReadSMS(this.port);
foreach (ShortMessage msg in objShortMessageCollection)
{
ListViewItem item = new ListViewItem(new string[] { msg.Index ,msg.Sender,msg.Message });
item.Tag = msg;
lvwMessages.Items.Add(item);
}
#endregion
}
else
{
lvwMessages.Clear();
MessageBox.Show("There is no message in SIM");
}
}
catch (Exception ex)
{
ErrorLog(ex.Message);
}
}
private void btnDeleteSMS_Click(object sender,EventArgs e)
{
try
{
请帮我注释一下下面C#的代码,objShortMessageCollection = objclsSMS.ReadSMS(this.port);foreach (ShortMessage msg in objShortMessageCollection){ListViewItem item = new ListViewItem(new string[] { msg.Index ,msg.Sender,msg.Message });item.Tag
大概这是个短信读取类
objShortMessageCollection = objclsSMS.ReadSMS(this.port);\\实例化objclsSMS,并从port端口读取短信
foreach (ShortMessage msg in objShortMessageCollection)//循环从objShortMessageCollection读取短信,赋到msg 变量(结构)中.
{
ListViewItem item = new ListViewItem(new string[] { msg.Index ,msg.Sender,msg.Message }); //定义listviewitem项目,把读到Msg结构的项目转到item中,
item.Tag = msg;//设置item包含有关控件的数据的对象为msg
lvwMessages.Items.Add(item);//把item 添加到 lvwMessages控制中.就是把短信相关内容加到 lvwMessages中.
}
#endregion
}
else
{
lvwMessages.Clear();//清除 lvwMessages项.
MessageBox.Show("There is no message in SIM");//提供在这个SIM卡中没有短信.
}
}
catch (Exception ex)
{
ErrorLog(ex.Message);//读取短信时异常.
}
}
private void btnDeleteSMS_Click(object sender,EventArgs e)
{
try
{