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。这个问题似乎是每次用户转到主页时都会重置该值。 –