예제 #1
0
        static void Main()
        {
            if (System.Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Thread to show splash window
            Thread thUI = new Thread(new ThreadStart(ShowSplashWindow));

            thUI.Name         = "Splash UI";
            thUI.Priority     = ThreadPriority.Highest;
            thUI.IsBackground = true;
            thUI.Start();

            //Thread to load time-consuming resources.
            Thread th = new Thread(new ThreadStart(LoadResources));

            th.Name     = "Resource Loader";
            th.Priority = ThreadPriority.Normal;
            th.Start();
            th.Join();

            if (SplashForm != null)
            {
                SplashForm.Invoke(new MethodInvoker(delegate { SplashForm.Close(); }));
            }
            thUI.Join();
            Application.Run(new Form1());
        }
예제 #2
0
파일: Splash.cs 프로젝트: muta6150/e
        static public void Close()
        {
            if (MySplashThread == null)
            {
                return;
            }

            if (MySplashForm == null)
            {
                return;
            }

            try
            {
                MySplashForm.Invoke(new MethodInvoker(MySplashForm.Close));
            }

            catch (Exception)
            {
            }

            MySplashThread = null;

            MySplashForm = null;
        }
예제 #3
0
 private static void CloseSplash()
 {
     if (splash == null)
     {
         return;
     }
     splash.Invoke(new EventHandler(splash.KillMe));
     splash.Dispose();
     splash = null;
 }
예제 #4
0
 static void HomeForm_Load(object sender, EventArgs e)
 {
     //close splash
     if (splashForm == null)
     {
         return;
     }
     splashForm.Invoke(new Action(splashForm.Close));
     splashForm.Dispose();
     splashForm = null;
 }
예제 #5
0
 private static void MainForm_LoadCompleted(object sender, EventArgs e)
 {
     if (SplashForm == null || SplashForm.Disposing || SplashForm.IsDisposed)
     {
         return;
     }
     SplashForm.Invoke(new Action(() => { SplashForm.Close(); }));
     SplashForm.Dispose();
     SplashForm = null;
     MainForm.Activate();
 }
예제 #6
0
        private static void HideSplashScreen()
        {
            if (_splash != null)
            {
                Action act = () =>
                {
                    _splash.Close();
                    _splashThread = null;
                };

                _splash.Invoke(act);
            }
        }
예제 #7
0
        static void Main(string[] args)
        {
            //高Dpi設定
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Thread to show splash window
            Thread thUI = new Thread(new ThreadStart(ShowSplashWindow))
            {
                Name         = "Splash UI",
                Priority     = ThreadPriority.Highest,
                IsBackground = true
            };

            thUI.Start();

            //Thread to load time-consuming resources.
            Thread th = new Thread(new ThreadStart(LoadResources))
            {
                Name     = "Resource Loader",
                Priority = ThreadPriority.Normal
            };

            th.Start();
            th.Join();

            if (SplashForm != null)
            {
                SplashForm.Invoke(new MethodInvoker(delegate { SplashForm.Close(); }));
            }
            thUI.Join();
            if (args.Length == 0)
            {
                Application.Run(new Form1());
            }
            else
            {
                Application.Run(new Form1(args[0].ToString()));
            }
        }
        public static void CloseSplash(SplashTypeOfMessage typeOfMessage, string message, bool itWasrinvoked)
        {
            CloseSplashHandler closeSpalshHandler = new CloseSplashHandler(CloseSplash);
            bool launched = false;

            while (!launched && !itWasrinvoked)
            {
                lock (SplashForm.locker)
                {
                    if (!SplashForm.WaitPlease)
                    {
                        launched = true;
                    }
                }
            }

            if (_splashForm != null && _splashThread != null)
            {
                if (_splashForm.InvokeRequired)
                {
                    _splashForm.Invoke(closeSpalshHandler, new object[] { typeOfMessage, message, true });
                }
                else
                {
                    switch (typeOfMessage)
                    {
                    case SplashTypeOfMessage.Warning:
                        break;

                    case SplashTypeOfMessage.Error:
                        MessageBox.Show("Error");
                        break;

                    default:
                        break;
                    }
                    _splashForm.Close();
                    _splashThread = null;
                }
            }
        }
예제 #9
0
        static void MainFormLoad(object sender, EventArgs e)
        {
            if (SplashScreen != null)
            {
                SplashScreen.Invoke(new Action(SplashScreen.Close));
                SplashScreen.Dispose();
            }

            MainForm form = (MainForm)sender;

            form.BringToFront();
            form.Activate();

            if (Arguments.Setwindow)
            {
                form.Left   = Arguments.Position_x;
                form.Top    = Arguments.Position_y;
                form.Width  = Arguments.Size_w;
                form.Height = Arguments.Size_h;

                form.WindowState = (FormWindowState)Arguments.Window_s;
            }
        }
 static public void CloseForm()
 {
     splashForm.Invoke(new CloseDelegate(SplashForm.CloseFormInternal));
 }
예제 #11
0
        public static void ChangeTitle(string status)
        {
            ChangeFormTextdelegate de = new ChangeFormTextdelegate(ChangeText);

            _SplashForm.Invoke(de, status);
        }
예제 #12
0
 //    internally used as a thread function - showing the form and
 //    starting the messageloop for it
 static void ShowThread()
 {
     MySplashForm = new SplashForm();
     MySplashForm.Visible = true;
     MySplashForm.Invoke(new MethodInvoker(MySplashForm.Show));
 }