WPF Loading
1、启动界面的实现方式
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
SplashScreen splashScreen = new SplashScreen("pic.jpg");
splashScreen.Show(true);
base.OnStartup(e);
}
}
二、页面加载的实现方式
public partial class WindowLoading : Window
{
public BackgroundWorker backgroundWorker;
public WindowLoading()
{
InitializeComponent();
backgroundWorker = new BackgroundWorker();
backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
Loaded += (s, e) => {
if (!this.backgroundWorker.IsBusy)
{
this.backgroundWorker.RunWorkerAsync();
}
};
}
void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.Close();
}
}

浙公网安备 33010602011771号