title: How to make main window wait until a newly opened window closes in C# WPF?
body: <p>I am new to WPF as well as C#, please bear with me.</p>
  
  <p>I have a main window which opens up a new window. Now this new window is a prompt whether or not to overwrite a file, and the main window accesses a public variable in the new window to check for the prompt's result.</p>
  
  <p>But I can't get the main window processing to wait until the new window closes.</p>
  
  <pre><code> Window1 Win = new Window1();
   Win.Show();
  
   if (Win.pr_res == 1)
   {
        abc.Text = "File to be overwritten";
        File.Delete(_destination);
        Start();
   }
   else
   {
        abc.Text = "Operation Aborted";
   }
  </code></pre>
  
  <p>I tried adding a while loop checking another public boolean in the main window, but that just hangs the entire program.</p>
  
  <pre><code> while(!_closecheck);
  </code></pre>
  
  <p>Any suggestions are welcome.</p>