阅读一条新短信,然后将状态更改为 'read'。 Windows 通用应用
read a new SMS and afterwards change the status to 'read'. Windows Universal app
我可以用这个代码阅读新短信
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,但它不起作用...有什么想法吗?
MarkAsSeenAsync 如 MSDN 上所写,将所有传输消息标记为可见。
所以如果你使用
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);
我可以用这个代码阅读新短信
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,但它不起作用...有什么想法吗?
MarkAsSeenAsync 如 MSDN 上所写,将所有传输消息标记为可见。 所以如果你使用
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);