大家好,我的程序要做的是这样的,这是一个主启动界面,页面启动后,后台去检查服务器上的版本。但是在进去这个主页面时,图片和文字都不显示(白屏),到最后才显示图片和文字,请教大家解决一下,我想要的效果,页面完全加载后(图片和文字都显示),再执行异步操作。
图片说明
public partial class frmStartProgress : Form
{
///
/// The configuration for the AppStart process.
///
private static AppStartConfiguration config = null;
/// <summary>
/// The process of the running application.
/// </summary>
private static Process applicationProcess;
BackgroundWorker worker = new BackgroundWorker();
public frmStartProgress()
{
InitializeComponent();
config = (AppStartConfiguration)System.Configuration.ConfigurationManager.GetSection("appStart");
label1.Text = string.Format("正在启动{0}系统,请稍候...", config.ApplicationName);
---------【****文字没有显示****】
}
private void frmStartProgress_Load(object sender, EventArgs e)
{
//// Grab our config instance which we use to read app.config params, figure out
//// WHERE our target app is and WHAT version
worker.WorkerReportsProgress = true;
worker.DoWork += new DoWorkEventHandler(worker_DoWork);
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
worker.RunWorkerAsync();
}
void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.progressBar1.Value = e.ProgressPercentage;
this.label1.Text = e.UserState.ToString();
}
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.Close();
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
StartAppProcess();
}
public delegate void AutoUpdateDelegate();
private void ChangeThread(AutoUpdateDelegate aud)
{
if (this.InvokeRequired)
{
this.Invoke(aud);
}
}
/// <summary>
/// Main process code.
/// </summary>
private void StartAppProcess()
{
ClearUpdateVersionFiles();
worker.ReportProgress(20, "正在检查是否有新的版本...");
----【**文字没有显示**】
bool processStarted = false;
if (config.UpdateTime == UpdateTimeEnum.BeforeStart)
{
//UpdateApplication();
ChangeThread(UpdateApplication);
}
//Start the application
try
{
worker.ReportProgress(50, "正在初始化应用程序");
........【**文字开始显示,图片也显示**】
自己研究才是最深的理解………………