title: Thread block for processing
body: <p>I'm coding a C# wpf app and I need to block processing in order to wait for an event.
  If I use Thread.Sleep() the event is never triggered, the UI also hangs, so I don't know what else to do.</p>
  
  <pre><code>switch (process.Action)
              {
                  case 1:
                      this.Goto(process.VarValue);
                      break;
  
                  case 2:
                      this.Extract(process.VarKey, process.VarValue);
                      break;
  
                  case 3:
                      this.Validate(new string[] { });
                      break;
  
                  default:
                      break;
              }
  </code></pre>
  
  <p>Like for "extract" case, it grabs information and sends event to service which opens another WPF window, which pops up, asking user for input.</p>
  
  <p>The UI shows, but submit button hangs, and then the application hangs, i m using unity, and eventaggregator, also Magellan for wpf, so the project is getting more and more complex.</p>
  
  <p>I am trying for a simpler method for the thread to wait, for the user input.</p>
  
  <p>Please advise.</p>
  
  <ol>
  <li>thread starts => switch</li>
  <li>on extract case => sends event to pop up service opens (wpf window, for user input)</li>
  <li>i am using thread.sleep(1000) till the service sends response EVENT</li>
  <li>but the application hangs, on using thread.sleep including the (pop up window).</li>
  <li>I want to wait for the user input on the main thread.</li>
  </ol>