示例#1
0
        private void FadeClose()
        {
            new System.Threading.Thread((frm) => {
                CheckUpdate form = (CheckUpdate)frm;
                while (!form.FormReady)
                {
                    System.Threading.Thread.Sleep(10);
                }
                while (form.Opacity > 0.0)
                {
                    SetOpacity Updater = form.UpdateOpacity;
                    if (Updater != null)
                    {
                        form.Invoke(Updater, form.Opacity - 0.02);
                    }
                    System.Threading.Thread.Sleep(4);
                }

                if (Closed != null)
                {
                    Closed = true;

                    while (Closed != null)
                    {
                        System.Threading.Thread.Sleep(100);
                    }
                }

                form.Invoke(new SendClose(() => { form.Close(); }));
            }).Start(this);
        }
示例#2
0
        internal CheckUpdate()
        {
            InitializeComponent();
            UpdateStatus(Engine.LoadTranslation(Engine.TLID.ProcessingLogin));

            new System.Threading.Thread(() => {
                DateTime Begin = DateTime.Now;

                while (Closed == false)
                {
                    if ((DateTime.Now - Begin).TotalSeconds > 20)
                    {
                        Invoke(new MethodInvoker(() => {
                            Process.Start(Application.ExecutablePath, "-retry " + (Program.Retry + 1));
                            Process.GetCurrentProcess().Kill();
                        }));
                        break;
                    }
                    System.Threading.Thread.Sleep(100);
                }

                Closed = null;
            }).Start();


            //FadeIn
            new System.Threading.Thread((frm) => {
                CheckUpdate form = (CheckUpdate)frm;
                while (!form.FormReady)
                {
                    System.Threading.Thread.Sleep(10);
                }
                while (form.Opacity < 1.0)
                {
                    SetOpacity Updater = form.UpdateOpacity;
                    if (Updater != null)
                    {
                        form.Invoke(Updater, form.Opacity + 0.02);
                    }
                    System.Threading.Thread.Sleep(3);
                }

                while (Program.Connecting)
                {
                    System.Threading.Thread.Sleep(500);
                }

                Invoke(new SetText(UpdateStatus), Engine.LoadTranslation(Engine.TLID.SearchingUpdates));
                FindUpdates();
            }).Start(this);
        }