Showing Form in own thread
<p>I want to show a little loading form while some time consuming operations are beeing performed in die main UI. More specific I'm importing an UI changing theme that will take a while (2-3 secounds) to perform it's changes.</p>

<p>However, it's no problem if the UI is blocked while it's loading but to instruct the user to wait I want to display an WaitForm that is beeing closed if the UI Thread has finished the loading process.</p>

<p>Here's how I thought it might work:</p>

<pre><code>static class WaitDialogManager
{
    private static bool _isVisible { get; set; } = false;

    private static Task _task;

    public static void ShowDialog()
    {
        if (!_isVisible)
        {
            _task = Task.Factory.StartNew(() =&gt;
            {
                WaitDialog _dialog = new WaitDialog();

                _isVisible = true;
                _dialog.Show();

                do
                {
                    System.Threading.Thread.Sleep(10);
                } while (_isVisible);

                _dialog.Hide();
                _dialog.Dispose();
                _dialog = null;
            });
        }
    }

    public static void CloseDialog()
    {
        _isVisible = false;
    }
}

private void UpdateUI() 
{
    WaitDialogManager.ShowDialog();

    SetUpUI();

    WaitDialogManager.CloseDialog();
}
</code></pre>

<p>Unfortunately it seems like the different thread has no effect?! Form is beeing loaded and showed but all winforms consits of white rectangles and no marquee progress bar is beeing showed.</p>

<p>Why is this? And how can I change the construct to make it work?</p>

<p>Thanks in advance, ADP</p>