0
我已將啓動屏幕添加到我的Windows 7 Phone應用程序,但每當用戶返回主頁時都會顯示。我試圖弄清楚在應用程序啓動過程中我只能顯示啓動畫面。我已經嘗試在App.xaml.cs中添加一個bool「firstLoad」,並在運行Application_Activated時將其設置爲false,但無法使用。WP7啓動屏幕顯示每次用戶轉到主頁
我的啓動畫面由主頁面處理。該方法稱爲ShowPopup
public partial class MainPage : PhoneApplicationPage
{
private Popup popup;
private BackgroundWorker backgroundWorker;
private bool firstLoad = true;
// Constructor
public MainPage()
{
InitializeComponent();
// Only want to do this once
ShowPopup();
}
}
private void ShowPopup()
{
if (firstLoad)
{
this.popup = new Popup();
this.popup.Child = new PopUpSplash();
this.popup.IsOpen = true;
StartLoadingData();
}
firstLoad = false;
}
我假設ShowPopup檢查'firstLoad'的值以確定是否顯示彈出窗口?你也應該顯式初始化'firstLoad'爲true。 – blt
我添加了ShowPopup方法來顯示我正在檢查firstLoad。這個問題似乎是每次用戶轉到主頁時都會重置該值。 –