Bloom.Program.CareForSplashScreenAtIdleTime C# (CSharp) Method

CareForSplashScreenAtIdleTime() private static method

private static CareForSplashScreenAtIdleTime ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private static void CareForSplashScreenAtIdleTime(object sender, EventArgs e)
        {
            //this is a hack... somehow this is getting called again, haven't been able to track down how
            //to reproduce, remove the user settings so that we get first-run behavior. Instead of going through the
            //wizard, cancel it and open an existing project. After the new collectino window is created, this
            //fires *again* and would try to open a new splashform
            if (_alreadyHadSplashOnce)
            {
                Application.Idle -= CareForSplashScreenAtIdleTime;
                return;
            }
            if(_splashForm==null)
                _splashForm = SplashScreen.CreateAndShow();//warning: this does an ApplicationEvents()
            else if (DateTime.Now > _earliestWeShouldCloseTheSplashScreen)
            {
                // BL-3192. If there is some modal in front (e.g. dropbox or screen DPI warnings), just wait. We'll keep getting called with these
                // on idle warnings until it closes, then we can proceed.
                if (_splashForm.Visible && !_splashForm.CanFocus)
                {
                    return;
                }
                CloseSplashScreen();
                CheckRegistration();
                if (_projectContext != null && _projectContext.ProjectWindow != null)
                {
                    var shell = _projectContext.ProjectWindow as Shell;
                    if (shell != null)
                    {
                        shell.ReallyComeToFront();
                    }
                }
            }
        }