0

在 xamarin 表单的 Prism 中,当应用程序被操作系统杀死后恢复时,导航堆栈如何恢复?

4

1 回答 1

0

在这里,您可以查看有关应用程序生命周期管理的官方 Prism 文档。

典型的应用程序生命周期事件是:

  • 初始化- 这发生在第一次启动应用程序时。
  • Resuming - 每次我们在应用程序暂停后从后台恢复应用程序时都会发生这种情况。
  • Sleeping - 当操作系统决定在我们的应用程序进入后台后冻结我们的应用程序时,就会发生这种情况

方法:

  protected override void OnResume()
        {
            base.OnResume();

            // TODO: Refresh network data, perform UI updates, and reacquire resources like cameras, I/O devices, etc.

        }

        protected override void OnSleep()
        {
            base.OnSleep();

            // TODO: This is the time to save app data in case the process is terminated.
            // This is the perfect timing to release exclusive resources (camera, I/O devices, etc...)

        }

面对这一点,您有在每种情况下都会调用的方法。您应该覆盖它们,并根据您的需要实现您想要的要求。

于 2018-10-10T13:16:53.653 回答