首页 > 解决方案 > UWP 从后台任务中读取注册表并将信息反馈给 UI

问题描述

我有点卡住了,需要关于几个问题的建议。我正在开发一个 UWP 应用程序以 toast 和活动磁贴的形式发送用户通知

在我的解决方案中,我添加了Windows 运行时组件(通用 Windows),它在时间触发器上执行后台任务。

我要解决的问题(到目前为止还没有运气)

  1. 后台任务可以读取注册表或 WMI 吗?有可能吗?
  2. 当用户打开/重新打开应用程序时,如何连接回我的后台任务以获取收集的数据

标签: c#.netvb.netuwp

解决方案


Can Background Task read registry or WMI? is it possible at all?

For security reason, UWP does not provide such api to access registry directly, The only way is that indirectly access registry with Win32 process from uwp. You can read registry values from a Win32 runFullTrust process launched from a UWP application

How could I connect back to my background tasks to get the collected data when a user opens / re-opens the app

You have many way to send the value back to UWP platform, such as store the key into app's local storage and retrieve from UWP platform, Or use AppService to communicate desktop extension and uwp client. For more please refer this document.


推荐阅读