Windows Phone 8.1语音命令应用程序激活(Windows Phone 8.1 Voice Commands App Activation)

编程入门 行业动态 更新时间:2024-10-25 16:27:56
Windows Phone 8.1语音命令应用程序激活(Windows Phone 8.1 Voice Commands App Activation)

我想在我的Windows Phone 8.1应用程序中集成一些语音命令。 我想要做的第一件事是通过语音命令打开我的应用程序并导航到某个页面。

根据MSDN文章Quickstart:语音命令(XAML),我可以使用App.xaml.cs中的protected virtual void OnActivated(IActivatedEventArgs args)方法来覆盖我的要求。 但它确实不会像我那样工作!

我有以下结构的方法:

protected override void OnActivated(IActivatedEventArgs args) { if (args.Kind == ActivationKind.VoiceCommand) { var commandArgs = args as VoiceCommandActivatedEventArgs; if (commandArgs != null) { // ... some logic here } } }

问题是当我通过说“我的应用程序的'打开'名称'[可选单词]”激活我的应用程序时,应用程序会打开,但Activated事件永远不会触发! 该应用程序打开,OnLaunched事件触发。 所以我甚至无法进入OnActivated方法。

有谁知道这个问题? 为什么我不能使用语音命令输入OnActivated方法?

PS我尝试使用模拟器和真实设备。

I want to integrate some voice commands in my windows phone 8.1 app. The first thing I want to do is to open my app by a voice command and navigate to a certain page.

According to MSDN article Quickstart: Voice commands (XAML) I can use the override of protected virtual void OnActivated(IActivatedEventArgs args) method in App.xaml.cs to meet my requirements. But it does'nt work the way I though it would!

I have the method with the following structure:

protected override void OnActivated(IActivatedEventArgs args) { if (args.Kind == ActivationKind.VoiceCommand) { var commandArgs = args as VoiceCommandActivatedEventArgs; if (commandArgs != null) { // ... some logic here } } }

The problem is when I'm activating my app by saying "Open 'name of my app' [optional words]" the app opens but the Activated event never fires! The app opens and OnLaunched event fires. So I can't even enter the OnActivated method.

Does anyone know the problem? Why can't I enter OnActivated method using voice commands?

P.S. I tried it with a simulator as well as with a real device.

最满意答案

你可以看到这篇文章, http://t.co/Q5hRxRPvwR是西班牙文,但你会明白的。

安装应用程序并运行它后,应安装xml,如文档中所述。

在向cortana询问“我能说什么?” 它会显示你所能说的一切,以及支持cortana的应用程序。 选择你的应用程序,你会看到你可以为你的应用程序说,如

在此处输入图像描述在此处输入图像描述

如果您说出您的应用可以收听的内容,您的应用就会被激活。

you can see this article, http://t.co/Q5hRxRPvwR is in spanish, but you will understand.

After you install the app and run it, the xml should be installed, like said in documentation.

After ask to cortana "What can I say?" it will show all you can said, and the apps that supports cortana. Choose you app and you will see what you can say for your app, like

enter image description here enter image description here

If you say what your app can listen, your app will be activated.

更多推荐

本文发布于:2023-07-29 20:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319535.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   语音   命令   Windows   Phone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!