本文介绍了[c#] [UWP]如何将消息从后台任务发送到前台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在后台任务和前台任务之间进行通信。我的应用程序将使用语音命令从后台任务激活。我想将消息从后台任务发送到前台。

I am trying to communicate between background task and foreground task. My app will activate from background task by using voice command. I want to send message from background task to foreground.

推荐答案

当我了解您有一个AppService,用于从语音命令激活应用程序并使用AppService主机的进程外后台任务。您可以修改您的AppService来托管它的进程内后台任务,并在App
类OnBackgroundActivated方法中处理您想要的内容。第二种方式,如果您不想修改您的语音AppService,那么您可以使用进程内托管创建新的AppService并将其用于通信。

As I understand you have an AppService for activation the app from voice command and using Out-of-Process background task for the AppService host. You can modify your AppService to host it In-Process background task and handle what you want in  App class OnBackgroundActivated method. The second way if you doesn't want modify  your voice AppService  then you can create a new AppService with In-Process hosting and use it for communication.


这篇关于[c#] [UWP]如何将消息从后台任务发送到前台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 11:53