C# Cortana VCD:set命令';s将目标导航到子文件夹中的页面

C# Cortana VCD:set命令';s将目标导航到子文件夹中的页面,c#,windows-phone-8.1,cortana,C#,Windows Phone 8.1,Cortana,我无法通过Cortana启动Windows Phone 8.1应用程序的特定页面。我已经注册了一张VCD,Cortana正在成功识别该命令。但当命令执行时,应用程序将启动其默认页面(MainPage.xaml)。我想启动ReportPage.xaml而不是MainPage.xaml 所有页面都位于名为“视图”的子文件夹下(与创建应用程序时的默认项目模板不同) 我尝试过几种组合,但都不起作用: <Navigate Target="ReportPage.xaml" /> <Navi

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

所有页面都位于名为“视图”的子文件夹下(与创建应用程序时的默认项目模板不同)

我尝试过几种组合,但都不起作用:

<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>

交通记者
报告交通事故
开始报告交通事故
报告
报告{SortOfIncident}
报告{sortoff事件}
开始报告
意外
发生的事情
速度陷阱
速度检查

假设您使用的是Windows应用商店应用程序(WinRT): 你是否在你的App.on激活方法中处理语音激活


是的,我确实丢失了这段代码。它现在可以工作了,但是如果您仍然需要手动导航到页面,我想知道Target属性的作用是什么。谢谢你的帮助!只是一件被遗忘已久的银与光时代的遗物。
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;
        }
    }
}