title: Form.Show() and Form.Visible ThreadSafe
body: <p>Ok..my main form consists of some user controls and some buttons that will open other forms.  I have a Background worker where the UI won't freeze up.  The background worker updates a clock on the form and also is checking a database for a certain condition to be met.  If the condition is met, this form is hidden and the new form is displayed.</p>
  
  <p>I am also doing a check to see if the second form is already open.  Because once I open it, I don't close it.  I just use hide and show.  So my problem is, I can't find a thread-safe way to create and open a form, or to show the form if it is already open.  I also have to Hide the current form.</p>
  
  <p>Here is the code I have</p>
  
  <pre><code>//bool variable to determine if i need to open the form
  if (inShift)
              {
                  frmInShift InShift = null;
                  if ((InShift = (frmInShift)IsFormAlreadyOpen(typeof(frmInShift))) == null)
                  {
                      InShift = new frmInShift();
                      InShift.RefToParent = this;
                  }
                  else
                  {
                      InShift.RefToParent = this;
                  }
                  InShift.ResetButtons();
                  InShift.Show();
                  this.Visible = false;
              }
  </code></pre>
  
  <p>I know this code works, I am using it on one of the buttons on the form. I just need to make this thread-safe.  Part of the problem is actually creating the form if it isn't already open.</p>
  
  <p>Should I do that check on the main thread? If that works, How will I call the Show() method?</p>
  
  <p>EDIT:
  I'm creating my second form on my main form load event.  So all I need to do is set a few public variables and show the form and hide the main form.</p>
  
  <p>My RunWorkerCompleted code looks like this:</p>
  
  <pre><code>            if (inShift)
              {                   
                  InShift.RefToParent = this;
                  InShift.ResetButtons();
                  InShift.Show();
                  //program freezes up here
                  this.Invoke(new ThisFormVisibleCB(ThisFormVisible), new object[] { false });
              }
  </code></pre>
  
  <p>The program freezes when I call Invoke on this to hide the form..help??</p>