对于Phone7的可执行模式有:TombstoningPage StateApplication statePersistent data Transient state。最让人关注的还是TombstoneTransient state,因为它们可以模拟多任务。在Tombstoned模式下,应用被操作系统Terminate了(这样做可以减少资源的占用),那么这时就需要保存Transient state,以备于应用复活后恢复应用原状态。那么对于Tombstone模式,主要是体现在应用的Lifecycle中。

一个应用的Lifecycle包括LaunchingRunningClosingDeactivatingActivating这五种运行态。DeactivatingActivating就是Tombstone下的运行态。在这两个运行态下可以添加代码来,来完成唤醒后的状态或数据的转移。在Beta版中,使用和显现都相当的麻烦,但是在正式版里,可以很清楚的看到运行结果。

    在调用Task时,一般都会使当前程序退出,然后启动Task,获取相关信息后,退出Task,再把相应信息传回给程序,这时就是由TombStone来实现的Task与程序的切换,但数据的传回需要自已编程序实现。以下就是以获取Email address为例来演示Tombstone.

 

深入学习Windows Phone7开发(四. Tombstone)

深入学习Windows Phone7开发(四. Tombstone)

深入学习Windows Phone7开发(四. Tombstone)

示例代码:http://www.daisy123.com/?page_id=275  tombstone.zip

相关文章:

  • 2021-11-04
  • 2021-10-03
  • 2021-12-25
  • 2021-09-14
  • 2021-05-26
  • 2021-10-06
  • 2021-11-23
  • 2021-07-29
猜你喜欢
  • 2021-12-16
  • 2021-06-01
  • 2021-07-18
  • 2021-05-29
  • 2021-08-11
  • 2021-05-20
相关资源
相似解决方案