I have a function that attempt to connect to a server and post information about the progress and result. but i just found out that while my function is working the application will "freeze" and since the whole connecting thing might take a while the user might think that the application is malfunctioning and try to quit. do you know how to get the function to update form before continuing the rest of function, so the user know the application is working.
private void TestConnection()
{
ResutBoxTable.Controls.Clear();
ResutBoxTable.RowStyles.Clear();
PrintResults("Starting connection test...", Color.White);
ImapClient client = new ImapClient(IncAddressTxt.Text, true, certificateCheckbox.Checked);
if (client.Connect())
{
PrintResults("Connection to incoming mail server succesful!",Color.Green );
PrintResults("Attempting to Login to incoming mail server...", Color.White);
if (client.Login(UserTxt.Text,PasswordTxt.Text))
{
PrintResults("Login to incoming mail server succesful succesfull!",Color.Green);
}
else
{
PrintResults("Failed to login to incoming mail server!", Color.Red);
PrintResults("Please check your login information and try agian.", Color.Red);
}
}
else
{
PrintResults("Failed to connect to incoming mail server!", Color.Red);
PrintResults("Please check your connection prameters and try again.", Color.Red);
}
PrintResults("Testing connection complete!",Color.White);
}
also if your answer has something to do with threading please throw 1 or 2 explanation lines as i only know threading theoretically and never used it myself. thanks for your attention.