WinLib.Forms.LoadingForm.Create C# (CSharp) Method

Create() public static method

Starts a splash loading form on a new thread running a separate message pump
public static Create ( string status, bool topMost = true ) : LoadingForm
status string
topMost bool
return LoadingForm
        public static LoadingForm Create(string status, bool topMost = true)
        {
            LoadingForm loadingForm = null;
            new Thread(new ThreadStart(() => {
                loadingForm = new LoadingForm(status, topMost);
                while (!loadingForm.stop)
                    Application.DoEvents();
                loadingForm.Close();
            })).Start();
            while (loadingForm == null || !loadingForm.IsHandleCreated)
                Application.DoEvents(); // usually splashForms are triggered by UI threads; if not, no harm done
            return loadingForm;
        }