Navigation Windows phone扩展后闪导航
我为我的windows phone应用程序创建了一个扩展的启动屏幕,但现在每次我在主页上按back时,它都会重新加载扩展的启动屏幕。是否可以将其从导航堆栈中删除,并让应用程序执行应用程序关闭事件 飞溅代码:Navigation Windows phone扩展后闪导航,navigation,windows-phone-8,splash-screen,back,Navigation,Windows Phone 8,Splash Screen,Back,我为我的windows phone应用程序创建了一个扩展的启动屏幕,但现在每次我在主页上按back时,它都会重新加载扩展的启动屏幕。是否可以将其从导航堆栈中删除,并让应用程序执行应用程序关闭事件 飞溅代码: public partial class ExtendedSplashScreen : PhoneApplicationPage { public ExtendedSplashScreen() { InitializeComponent();
public partial class ExtendedSplashScreen : PhoneApplicationPage
{
public ExtendedSplashScreen()
{
InitializeComponent();
//Call MainPage from ExtendedSplashScreen after some delay
Splash_Screen();
}
async void Splash_Screen()
{
await Task.Delay(TimeSpan.FromSeconds(3)); // set your desired delay
NavigationService.Navigate(new Uri("/Screens/HomeScreen.xaml", UriKind.Relative));
}
是的,您可以将其从后堆栈中删除,请尝试此操作
inta=NavigationService.BackStack.Count();
而(a>0)
{
this.NavigationService.RemoveBackEntry();
a=导航服务.BackStack.Count();
}
此处使用a>0,因为主页上不应出现任何内容 将此代码放在HomeScreen.xaml.cs文件中:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
while (this.NavigationService.BackStack.Any())
{
this.NavigationService.RemoveBackEntry();
}
}
它将清理Backback,以便在按下back按钮时退出应用程序。可能重复的