예제 #1
0
        public static void Initialize()
        {
            Thread thread = new Thread(new ThreadStart(ShowSplash));

            thread.IsBackground = true;
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            while (m_Splash == null)
            {
                Thread.Sleep(200);
            }

            if (InitializeModules())
            {
                if (m_Splash != null)
                {
                    m_Splash.ThreadClose();
                }

                if (Globals.MainForm != null)
                {
                    Application.Run(Globals.MainForm);
                }
            }
        }
        // --------------------------------------------------------------
        #region LOCAL FUNCTIONS
        // --------------------------------------------------------------

        /// <summary>
        /// Initialize the app
        /// </summary>
        private static void Initialize()
        {
            // create the splash screen thread (in background)
            Thread thread = new Thread(new ThreadStart(ShowSplash))
            {
                IsBackground = true
            };

            // set the thread as single thread
            thread.SetApartmentState(ApartmentState.STA);

            // start the thread
            thread.Start();

            // wait for the splash screen to be created
            while (m_Splash == null)
            {
                Thread.Sleep(200);
            }

            // initialize the app modules
            if (InitializeModules())
            {
                // is the splash screen gone? close that thread
                if (m_Splash != null)
                {
                    m_Splash.ThreadClose();
                }

                // if the main form is not visible yet, we show it
                if (Globals.MainForm != null)
                {
                    Application.Run(Globals.MainForm);
                }
            }
        }