Advertisement
Uziel

Method Timeout exception

Mar 21st, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. private void BtnBuildClick(object sender, EventArgs e)
  2.         {
  3.             _itemsToLoad.CompleteAdding();
  4.             Task[] runnerTasks = new Task[1];
  5.             runnerTasks[0] = Task.Factory.StartNew(RunBuilder, TaskCreationOptions.LongRunning);
  6.             Task.Factory.ContinueWhenAll(runnerTasks, completedTasks => TaskIsComplete());
  7.        
  8.             foreach (item in _itemsToLoad.GetConsumingEnumerable())
  9.                 WaitUntil3rdPartyIsReady();
  10.         }
  11.  
  12.  
  13.  public void WaitUntil3rdPartyIsReady()
  14.         {
  15.             //if this takes longer than X seconds, I want to let the user know via a message box
  16.             //and then exit the thread and do some cleanup (close 3rd party programs that were opened as child windows)
  17.  
  18.             while (!_Window.ChildWindows.Exists(c => c.Class == "TEdit"))
  19.             {
  20.  
  21.             }
  22.             while (!_Window.ChildWindows.Find(c => c.Class == "TEdit").IsVisible)
  23.             {
  24.  
  25.             }
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement