操作暂停,恢复和激活窗口10 UWP
在Windows 8.1中的普遍应用,挂起/恢复模式用处理的 NavigationHelper.cs
答 SuspensionManager.cs
包含在APP模板类。这些类似乎并没有在那里在windows 10 UWP应用程序。有没有使我们能够处理挂起/恢复状态的方法是什么?
In the windows 8.1 universal apps, the suspend/resume modes were handled using the NavigationHelper.cs
ans SuspensionManager.cs
classes included in the APP template. These classes doesn't seem to be there in the windows 10 UWP apps. Is there a way by which we can handle the suspend/resume states?
有由社区正在开发一个有趣的框架(但主要是我觉得杰里·尼克松,安迪·威格利等)称为Template10。 Template10有引导程序类 OnSuspending
和 OnResuming
虚拟方法,您可以覆盖。我不知道那有做悬架/带Template10尚未恢复的确切的例子,但这个想法似乎是做的 App.xaml.cs从这个引导程序类继承,所以你可以很容易地覆盖我提到的方法。
There's an interesting framework being developed by the community (but mostly I think Jerry Nixon, Andy Wigley etc.) called Template10. Template10 has a Bootstrapper class with OnSuspending
and OnResuming
virtual methods that you can override. I am not sure that there's an exact example of doing suspension/resuming yet with Template10, but the idea seems to be to make App.xaml.cs inherit from this Bootstrapper class so you can easily override the methods I mentioned.
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
}
}