c# - Cortana 应用程序和语音命令未显示或无法从 Cortana 运行

标签 c# cortana

当键入“我能说什么?”时,Cortana 中不显示应用程序和语音命令

我正尝试在 Cortana 的前台使用语音命令并运行 Cortana 语音命令示例,但无法让 Cortana 显示应用程序或打开/执行名为“AdventureWorks”的应用程序的语音命令。

我使用的是 Cortana 语音命令示例,我在 Windows 10 上本地从 Visual Studio 2015 运行调试。根据此链接,这应该会在我的本地计算机上创建示例的解包版本,我应该能够从“开始”屏幕看到我不能看到的版本。 我已在应用程序的功能下激活麦克风并包含 en-GB resources.resw 文件并将 Package.appxmanifest 更改为 en-GB 的默认语言以匹配以确保 Cortana 的语言与应用程序匹配以消除这是一个潜在的问题。

这是一个链接,显示在从 VS 运行应用程序(有或没有调试)后,应用程序的未打包版本应该在开始屏幕中可见: How to deploy a Metro App to the Desktop?

Cortana 语音命令示例: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/CortanaVoiceCommand

注意: 除了我之外,该应用程序是标准的,包括 en-GB 资源文件,将 package.appxmanifest 位置更改为 en-GB 并将麦克风添加到应用程序的功能中。我的电脑上也启用了开发者模式。

更新:将 vcd.xml 添加到 VoiceCommandDefinitionManager 时没有发生异常。看起来应该可以正常工作。 我还注意到,在运行示例时,我看不到伦敦的图片,也看不到这个视频中说“正在收听”的麦克风图标:https://channel9.msdn.com/Events/Build/2015/3-716在 04:16

此时谷歌搜索“application not showing in Cortana”没有显示任何有用的结果。

有没有其他人有幸让这个示例工作?或类似问题?您还在使用 en-GB 版本吗?

任何帮助或想法将不胜感激

最佳答案

我已经使用 en-US 成功测试了 AdverntureWorks 样本。 我还开发了另一个 sample关于 Cortana 前景。

基本上我已经创建了 VCD 然后安装了它:

protected async override void OnLaunched(LaunchActivatedEventArgs e)
{
    ...
    // Install the VCD
    try
    {
        StorageFile vcdStorageFile = await Package.Current.InstalledLocation.GetFileAsync(@"HomeControlCommands.xml");
        await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(vcdStorageFile);
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.WriteLine("There was an error registering the Voice Command Definitions", ex);
    }
}

然后处理激活:

protected override void OnActivated(IActivatedEventArgs e)
{
    // Handle when app is launched by Cortana
    if (e.Kind == ActivationKind.VoiceCommand)
    {
        VoiceCommandActivatedEventArgs commandArgs = e as VoiceCommandActivatedEventArgs;
        SpeechRecognitionResult speechRecognitionResult = commandArgs.Result;

        string voiceCommandName = speechRecognitionResult.RulePath[0];
        string textSpoken = speechRecognitionResult.Text;
        IReadOnlyList<string> recognizedVoiceCommandPhrases;

        System.Diagnostics.Debug.WriteLine("voiceCommandName: " + voiceCommandName);
        System.Diagnostics.Debug.WriteLine("textSpoken: " + textSpoken);

        switch (voiceCommandName)
        {
        ...
        }
    }
}

详细过程描述here

关于c# - Cortana 应用程序和语音命令未显示或无法从 Cortana 运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31809161/

相关文章:

c# - 用列表替换 IEnumerable

uwp - 如何让Cortana听懂造词的发音?

voice - 调用语音命令定义管理器导致线程执行停止

windows-10 - Cortana 技能不适用于 Windows 10 或 iOS

c# - 没有短语列表的 UWP Cortana

windows-10 - Cortana 命令仅在说出时有效

c# - 是否可以在 WinForms 中旋转按钮控件?

c# - Telerik RadCalendar - 特别日子 : How to display Date of the Special Day

c# - 用于常见媒体播放器功能的 Windows API?

c# - 更新 viewModel 中的属性