2
您能否解釋如何在首次啓動或崩潰時顯示啓動頁面或在Windows Phone中終止應用程序。僅在第一次啓動時或在應用程序崩潰或應用程序崩潰後顯示啓動頁面
您能否解釋如何在首次啓動或崩潰時顯示啓動頁面或在Windows Phone中終止應用程序。僅在第一次啓動時或在應用程序崩潰或應用程序崩潰後顯示啓動頁面
您可以使用IsolatedStorage檢查,如果應用程序是以前打開過
private static bool hasSeenIntro;
/// <summary>Will return false only the first time a user ever runs this.
/// Everytime thereafter, a placeholder file will have been written to disk
/// and will trigger a value of true.</summary>
public static bool HasUserSeenIntro()
{
if (hasSeenIntro) return true;
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
if (!store.FileExists(LandingBitFileName))
{
// just write a placeholder file one byte long so we know they've landed before
using (var stream = store.OpenFile(LandingBitFileName, FileMode.Create))
{
stream.Write(new byte[] { 1 }, 0, 1);
}
return false;
}
hasSeenIntro = true;
return true;
}
}
對於崩潰的系統,可以使用BugSense for Windows Phone