I have a windows phone 7 application how do I make sure it supports fast task switching?

前端 未结 2 1846
野的像风
野的像风 2021-02-04 10:56

What do I need as a developer to be sure my apps support fast task switching?

Ideally, I\'m looking for like a developer check list of dos and don\'ts.

I did sea

2条回答
  •  时光说笑
    2021-02-04 11:50

    If you're upgrading from a normal tombstoning application in Windows Phone 7.0, the only thing you will need to change is the check for e.IsApplicationInstancePreserved in the Application_Activated event - if this property is set to true, it means that you don't have to rehydrate from IsolatedStorage / State. As mentioned in Chris Koenig's excellent answer:

    //Windows Phone 7.0
    private void Application_Activated(object sender, ActivatedEventArgs e)
    {
        RestoreStateFromTombstone();
    }
    
    //Windows Phone 7.1/7.5/Mango
    private void Application_Activated(object sender, ActivatedEventArgs e)
    {
        if (!e.IsApplicationInstancePreserved)
        {
            RestoreStateFromTombstone();
        }
    }
    

    Symptoms for this are your databindings no longer working after you switch apps via multitasking (since you are recreating your object states so the databinding is no longer valid)

提交回复
热议问题