Bel*_*lls 8 c# windows-store-apps windows-8.1 windows-10
在Windows 8.1通用应用程序中,使用APP模板中包含的NavigationHelper.csans SuspensionManager.cs类处理挂起/恢复模式.Windows 10 UWP应用程序中似乎没有这些类.有没有办法处理暂停/恢复状态?
社区正在开发一个有趣的框架(但我认为主要是Jerry Nixon、Andy Wigley等),称为 Template10。Template10 有一个Bootstrapper类,其中包含OnSuspending可以OnResuming重写的虚拟方法。我不确定是否有使用 Template10 进行暂停/恢复的确切示例,但其想法似乎是让App.xaml.cs 继承自此 Bootstrapper类,以便您可以轻松重写我提到的方法。
sealed partial class App : Common.BootStrapper
{
public App()
{
InitializeComponent();
this.SplashFactory = (e) => null;
}
public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// start the user experience
NavigationService.Navigate(typeof(Views.MainPage), "123");
return Task.FromResult<object>(null);
}
public override Task OnSuspendingAsync(object s, SuspendingEventArgs e)
{
// handle suspending
}
public override void OnResuming(object s, object e)
{
// handle resuming
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3044 次 |
| 最近记录: |