Cortana RequestDisambiguationAsync 错误
Cortana RequestDisambiguationAsync Error
我正在尝试通过为我的应用程序工作的 Cortana 让用户与后台应用程序进行交互。
每当我执行 RequestDisambiguationAsync(response) 时,Cortana 都会说它 运行 出错了。但是,它在 Visual Studio 的任何地方都没有中断。
关于可能导致它的原因有什么想法吗?下面是我正在使用的代码:
var userPrompt = new VoiceCommandUserMessage();
string home1 = data.Structures[0].Name;
string home2 = data.Structures[1].Name;
userPrompt.DisplayMessage = "Which one did you want to set to home?";
userPrompt.SpokenMessage = String.Format("Which one did you want to set to home? {0} or {1}?", home1, home2);
var userReprompt = new VoiceCommandUserMessage();
userReprompt.DisplayMessage = "Which one did you want to set to home?";
userReprompt.SpokenMessage = "Which one did you want to set to home?";
var structuresContentTiles = new List<VoiceCommandContentTile>();
var structureTile = new VoiceCommandContentTile();
structureTile.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;
structureTile.Title = home1;
structureTile.AppContext = data.Structures[0].Structure_id;
structuresContentTiles.Add(structureTile);
var structureTile2 = new VoiceCommandContentTile();
structureTile2.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;
structureTile2.Title = home2;
structureTile.AppContext = data.Structures[1].Structure_id;
structuresContentTiles.Add(structureTile2);
var response = VoiceCommandResponse.CreateResponseForPrompt(userPrompt, userReprompt, structuresContentTiles);
var voiceCommandDisambiguationResult = await voiceServiceConnection.RequestDisambiguationAsync(response);
在某些情况下,当您使用
时可能会出现此行为
structureTile.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;
但不提供图像。将其更改为 VoiceCommandContentTileType.TitleOnly,或者如果您提供的是 Line1,请使用 VoiceCommandContentTileType.TitleWithText,或者提供图像,这样应该可以阻止故障的发生。
我正在尝试通过为我的应用程序工作的 Cortana 让用户与后台应用程序进行交互。
每当我执行 RequestDisambiguationAsync(response) 时,Cortana 都会说它 运行 出错了。但是,它在 Visual Studio 的任何地方都没有中断。
关于可能导致它的原因有什么想法吗?下面是我正在使用的代码:
var userPrompt = new VoiceCommandUserMessage();
string home1 = data.Structures[0].Name;
string home2 = data.Structures[1].Name;
userPrompt.DisplayMessage = "Which one did you want to set to home?";
userPrompt.SpokenMessage = String.Format("Which one did you want to set to home? {0} or {1}?", home1, home2);
var userReprompt = new VoiceCommandUserMessage();
userReprompt.DisplayMessage = "Which one did you want to set to home?";
userReprompt.SpokenMessage = "Which one did you want to set to home?";
var structuresContentTiles = new List<VoiceCommandContentTile>();
var structureTile = new VoiceCommandContentTile();
structureTile.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;
structureTile.Title = home1;
structureTile.AppContext = data.Structures[0].Structure_id;
structuresContentTiles.Add(structureTile);
var structureTile2 = new VoiceCommandContentTile();
structureTile2.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;
structureTile2.Title = home2;
structureTile.AppContext = data.Structures[1].Structure_id;
structuresContentTiles.Add(structureTile2);
var response = VoiceCommandResponse.CreateResponseForPrompt(userPrompt, userReprompt, structuresContentTiles);
var voiceCommandDisambiguationResult = await voiceServiceConnection.RequestDisambiguationAsync(response);
在某些情况下,当您使用
时可能会出现此行为structureTile.ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText;
但不提供图像。将其更改为 VoiceCommandContentTileType.TitleOnly,或者如果您提供的是 Line1,请使用 VoiceCommandContentTileType.TitleWithText,或者提供图像,这样应该可以阻止故障的发生。