gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-30 01:34:08 24 4
gpt4 key购买 nike

当键入“我能说什么?”时,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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com