Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. ReallyBusyForm.Show();
  2. ReallyBusyForm.Focus();
  3.  
  4. var floatingWindow = new FloatingLoadingWindow();
  5. Task.Run(() => floatingWindow.ShowDialog());
  6. await Task.Run(() => ReallyBusyForm.LoadYourControls());
  7. Invoke((MethodInvoker)(() =>
  8. {
  9. while (Application.OpenForms["FloatingLoadingWindow"] == null)
  10. {
  11. Thread.Sleep(200);
  12. }
  13. floatingWindow.Close();
  14. }));
  15.  
  16. floatingWindow.ShowDialog(); //this call obviously block the execution of what comes next
  17. await Task.Run(() => ReallyBusyForm.LoadYourControls());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement