Do you use Threading to make your user interfaces more responsive?
Last updated by Igor Goldobin about 1 year ago.See historyThreading is not only used to allow a server to process multiple client requests - it could make your user interfaces responsive when your application is performing a long-running process, allowing the user to keep interactive.
:: bad

private void Form1_Load(object sender, EventArgs e)
{
this.ValidateSQLAndCheckVersion();// a long task
}
Code: No threading code for long task


private void Page05StorageMechanism_Load(object sender, EventArgs e)
{
this.rsSetupOk = false;
this.databaseSetupOk = false;
this.NextButtonState.Enabled = false;
CheckDatabase();
CheckReports();
}
public void CheckDatabase()
{
if(sqlConnectionString == null)
{
OnValidationFinished(false, false);
}
if(upgradeScriptPath ==null && createScriptPath == null)
{
OnValidationFinished(false, false);
}
Thread thread = new Thread(new ThreadStart(this.ValidateSQLAndCheckVersion) ) ;
thread.Name = "DBCheckingThread";
thread.Start();
}
Code: Threading code for long task