コード例 #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
ファイル: MainStartup.cs プロジェクト: tnt-wolve/Emby
        private static void HideSplashScreen()
        {
            if (_splash != null)
            {
                Action act = () =>
                {
                    _splash.Close();
                    _splashThread = null;
                };

                _splash.Invoke(act);
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: shchang508/Woodpecker
        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()));
            }
        }
コード例 #8
0
        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;
            }
        }
コード例 #10
0
 static public void CloseForm()
 {
     splashForm.Invoke(new CloseDelegate(SplashForm.CloseFormInternal));
 }
コード例 #11
0
ファイル: SplashScreen.cs プロジェクト: ShuPingNet/XSmartNote
        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));
 }