我可以使用此代码阅读新短信
Windows.ApplicationModel.Chat.ChatMessageStore store = await Windows.ApplicationModel.Chat.ChatMessageManager.RequestStoreAsync();
var msgList = store.GetMessageReader();
IReadOnlyList<Windows.ApplicationModel.Chat.ChatMessage> a = await msgList.ReadBatchAsync();
foreach (var item in a)
{
if (item.IsSeen)
{
Don't do anything.. SMS is Readed
}
else
{
item.IsSeen=True (This not work because don't save this status) }
我尝试Mark IsSeen,但它不起作用......任何想法?
答案 0 :(得分:1)
MarkAsSeenAsync标记所有传输消息。 所以,如果你使用
store.MarkAsSeenAsync()
您将标记所有消息
但你可以使用第二次覆盖
store.MarkAsSeenAsync(IIterable(String))
作为IIterable(String),您可以使用集合
List<string>
带有消息ID。 您的代码将如下所示:
Windows.ApplicationModel.Chat.ChatMessageStore store = await Windows.ApplicationModel.Chat.ChatMessageManager.RequestStoreAsync();
var msgList = store.GetMessageReader();
IReadOnlyList<Windows.ApplicationModel.Chat.ChatMessage> a = await msgList.ReadBatchAsync();
List<string> l = new List<string>();
foreach (Windows.ApplicationModel.Chat.ChatMessage item in a)
{
if (!item.IsSeen) l.Add(item.Id);
}
await store.MarkAsSeenAsync(l);