How to make the "Verifying done" string show at the end and not before Task2 finish statement show?

  • Thread starter Thread starter Jane Jie Chen
  • Start date Start date
J

Jane Jie Chen

Guest
We are create WPF tool to verify system components are the same.

Each component includes number of files.

for an example, we have two verify components:

public void VerifyConfigurationFiles()

{

for each file, perform file comparison and update file status for each comparison result.

UpdateListBox("Verify configuration files done.");

}

public void VerifyInstallationFiles()

{

for each file, perform file comparison and update file status for each comparison result.

UpdateListBox("Verify installation files done.");

}

Since each VerifyComponent function takes a long time to finish. In order to make update file status in the ListBox in real time and not block the UI, we have implement the following Async call by using await and Task:


private void Verify()
{
UpdateListBox("Verifying start...");

await Task.Factory.StartNew(VerifyConfigurationFiles);

await Task.Factory.StartNew(VerifyInstallationFiles);

UpdateListBox("Verifying done.)";

}

Everything works fine. Each verified file status displays after comparison done.

Only we notice that sometime that

"Verifying done" displays before "Verify installation done.".

We want to ensure following display order:

Verify installation files done.

Verifying done.

How could we archive that? Thx!

Continue reading...
 
Back
Top