Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在应用程序启动时,根据变量重定向到特定页面_C#_Windows Phone 7_Xaml - Fatal编程技术网

C# 在应用程序启动时,根据变量重定向到特定页面

C# 在应用程序启动时,根据变量重定向到特定页面,c#,windows-phone-7,xaml,C#,Windows Phone 7,Xaml,可能重复: 默认情况下,windows phone应用程序在启动时会导航到“MainPage.xaml”。如何通过基于某些变量重定向到其他页面来进行干预 例如,如果var a为true,则转到page1.xaml,否则转到page2.xaml 谢谢你的帮助 我要做的是这个i app.xmal.cs文件` private void Application_Launching(object sender, LaunchingEventArgs e) { SetupD

可能重复:

默认情况下,windows phone应用程序在启动时会导航到“MainPage.xaml”。如何通过基于某些变量重定向到其他页面来进行干预

例如,如果var a为true,则转到page1.xaml,否则转到page2.xaml


谢谢你的帮助

我要做的是这个i app.xmal.cs文件`

    private void Application_Launching(object sender, LaunchingEventArgs e)
    {
        SetupDefautPage();
    }

    private void Application_Activated(object sender, ActivatedEventArgs e)
    {            
        SetupDefautPage();
    }`
我的void
SetupDefautPage
如下所示:

 void SetupDefautPage()
    {
        if ((DefaultPage !=false)&&(DefaultPage !=true)) 
        {
            (Application.Current as App).DefaultPage = false;
        }

        if (DefaultPage==false)
         {
            ((App)Application.Current).RootFrame.Navigate(new Uri("/TermUsePage.xaml", UriKind.Relative));
         }
        else if(DefaultPage==true)
         {
           ((App)Application.Current).RootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
         }


    }
这只是一个想法,我希望这对你有好处