'''
If Forms("叮咚聊天").Opened Then
Dim 内容 As String=""
'''
Dim id As Integer = DataTables("叮咚聊天_Table1").Compute("Max(_Identify)")
Dim Filter As String = "已读人='' and 接收人='" & _账户ID & "' "
DataTables("叮咚聊天_Table1").AppendLoad(Filter, False)
For Each r As Row In Tables("叮咚聊天_Table1").Rows
Dim 联系,已读,接收 As String
联系=""
已读=""
接收=""
Dim dr As DataRow = DataTables("叮咚好友").Find("联系人 = '" & r("发送人") & "'" )
If dr IsNot Nothing Then '如果找到的话
联系=dr("好友备注")
Else
联系= r("发送人")
End If
Dim dr0 As DataRow = DataTables("叮咚好友").Find("联系人 = '" & r("接收人") & "'" )
If dr0 IsNot Nothing Then '如果找到的话
接收=dr0("好友备注")
Else
接收= r("接收人")
End If
If r.IsNull("已读人") Then
已读="□"
内容= 内容 & vbcrlf & vbcrlf & 联系 & " " & r("发送时间") & vbcrlf & r("发送内容")
Else
已读="?"
End If
r("聊天记录")="[" & 联系 & "]→[" & 接收 & "] " & r("发送时间") & " " & 已读 & vbcrlf & " " & r("发送内容")
Forms("叮咚聊天").Controls("新消息提醒").Visible=True
r("已读人")=_账户ID
r.Save
Next
If 内容="" Then
Else
Myform.Msgbox( 内容 ,"您有新的叮咚消息!" ,True)
End If
Dim Products As List(Of String)
Products = DataTables("叮咚好友").GetValues("类型")
For Each Product As String In Products
'找出所有的类型Product
Dim Page As WinForm.TopicPage
Page = Forms("叮咚聊天").Controls("TopicBar1").Pages.Add(Product,Product)
For Each dr As DataRow In DataTables("叮咚好友").DataRows
If dr("类型")=Product Then
Dim 未读数 As Integer = 0
未读数 = DataTables("叮咚聊天_Table1").Compute("Count(发送人)", "发送人 = '" & dr("联系人") & "' and 接收人='" & _账户ID & "' and 已读时间 is null" )
Dim 未读 As String
If 未读数>0 Then
未读 ="("& 未读数 &")"
Else
未读=""
End If
Page.Links.Add( dr("联系人") ,"?" & dr("好友备注")& 未读)
End If
Next
Next
End If