Cortana VCD:将命令的导航目标设置为子文件夹中的页面

Cortana VCD: set command's Navigate target to a Page in a subfolder

我在通过 Cortana 启动 Windows Phone 8.1 应用程序的特定页面时遇到问题。我已经注册了一张 VCD,Cortana 成功识别了该命令。但是当执行命令时,应用程序将启动其默认页面 (MainPage.xaml)。我想启动 ReportPage.xaml 而不是 MainPage.xaml。

所有页面都在名为 "View" 的子文件夹下(与创建应用程序时的默认项目模板不同)。

我尝试了几种组合,但 none 奏效了:

<Navigate Target="ReportPage.xaml" />
<Navigate Target="View/ReportPage.xaml" />
<Navigate Target="/View/ReportPage.xaml" />
<Navigate Target="ReportPage" />

这是我的 VCD:

<?xml version="1.0" encoding="utf-8"?>

<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1">
  <CommandSet xml:lang="en-US">
    <CommandPrefix>Traffic Reporter</CommandPrefix>
    <Example>Report a traffic incident</Example>

    <Command Name="ReportIncident">
      <Example>Start reporting a traffic incident</Example>
      <ListenFor>Report</ListenFor>
      <ListenFor>Report an {SortOfIncident}</ListenFor>
      <ListenFor>Report a {SortOfIncident}</ListenFor>
      <Feedback>Starting the report</Feedback>
      <Navigate Target="ReportPage.xaml" />
    </Command>

    <PhraseList Label="SortOfIncident">
      <Item>accident</Item>
      <Item>incident</Item>
      <Item>speed trap</Item>
      <Item>speed check</Item>
    </PhraseList>

  </CommandSet>
</VoiceCommands>

假设您在 Windows 商店应用程序 (WinRT) 中: 你在 App.OnActivated 方法中处理语音激活吗?

protected override void OnActivated(IActivatedEventArgs args)
{
    if (args.Kind == ActivationKind.VoiceCommand)
    {
        Frame rootFrame = Window.Current.Content as Frame;
        VoiceCommandActivatedEventArgs vcArgs = (VoiceCommandActivatedEventArgs)args;

        //check for the command name that launched the app
        string voiceCommandName = vcArgs.Result.RulePath.FirstOrDefault();

        switch (voiceCommandName)
        {
            case "ViewEntry":
                rootFrame.Navigate(typeof(ViewDiaryEntry), vcArgs.Result.Text);
                break;
            case "AddEntry":
            case "EagerEntry":
                rootFrame.Navigate(typeof(AddDiaryEntry), vcArgs.Result.Text);
                break;
        }
    }
}