Do you use Threading to make your user interfaces more responsive?

Updated by Igor Goldobin 1 year ago. See history

123
No component provided for introEmbed

:: bad

Image

Figure: Bad example - Unresponsive UI because no threading code

:::

private void Form1_Load(object sender, EventArgs e)
{
this.ValidateSQLAndCheckVersion();// a long task
}

Code: No threading code for long task

Image

✅ Figure: Good example - Responsive UI in progress

Image

✅ Figure: Good example - Responsive UI completed

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

Acknowledgements

Adam Cogan
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star