我已向我的 Windows 7 Phone 应用添加了一个初始屏幕,但每次用户返回主页时都会显示该屏幕。 我试图弄清楚如何在应用程序启动期间仅显示初始屏幕。 我尝试将布尔值"firstLoad"添加到 App.xaml .cs并在运行时将其设置为 false Application_Activated但这不起作用。
我的初始屏幕由主页处理。 该方法称为 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;
}
将全局变量添加到 App.xaml.cs。 在 MainPage.xaml 中将变量设置为 false.cs当 ShowPopup() 运行时。 问题已解决