title: C# Delay Modal Dialog showing on Load, whilst allowing execution to continue
body: <p>I have a form being displayed by a static method. </p>
  
  <p>This static method calls ShowDialog on the form:</p>
  
  <pre><code>//Static method on LockWaitForm
  public static LockDetails Lock(string lockedMessage, object[] params parameters)
  {
          using (LockWaitForm form = new LockWaitForm(parameters))
          {
              form._lockedMessage.Text = lockedMessage;
  
              DialogResult result = form.ShowDialog();
  
              return new LockDetails (form._lockStatus, form._lock);
          }
   }
  </code></pre>
  
  <p>What I want is the OnLoad method of the dialog to wait <em>up to</em> one second before it shows, so it will only display if a lock on a record cannot be achieved after 1 second. It will happily drop out before one second if a lock is obtained before 1 second, setting its DialogResult to OK. </p>
  
  <p>All functionality works fine except the hiding of the Dialog box for 1 second. All 'Visible = false' calls are ignored, and I can kind of understand why they would do that. The problem with this is that a false 'record is locked' will flash up for a sub second every time the form is used and a lock can be obtained without an issue.</p>
  
  <p>I can figure out a few hacky ways to delay the visibility of the dialog box</p>
  
  <ul>
  <li>Set Opacity to 0% - this does not work for Remote Desktop Connections</li>
  <li>Have the form only be initialized by the static method once the 1 second has elapsed. This is promising, but requires a lot of repeated static vs non static code to handle the setup and disposal of the lock, and still feels a bit hacky.</li>
  </ul>
  
  <p>Is it possible to limit the display of a Modal Dialog called through ShowDialog? I am reluctantly happy to PInvoke at this point (though I do want to limit non-64bit code for future requirements)</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>By moving my acquire lock code to the form's constructor instead of Load, I can keep the locking code in one place, and just wait while the form's lock status is in a Waiting state before calling ShowDialog. Still feels dirty, but the cleanest method so far</p>