示例#1
0
 private void refreshDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LocalDatabase.LoadDatabase();
 }
示例#2
0
        private void DelayInitialize(object background)
        {
            //run in background
            if ((bool)background)
            {
                this.Cursor = Cursors.AppStarting;
                System.Threading.ThreadPool.QueueUserWorkItem(DelayInitialize, false);
                return;
            }

            //load problem database
            LocalDatabase.RunLoadAsync(false);

            //load controls
            bool _initialized = false;

            this.BeginInvoke((MethodInvoker) delegate
            {
                //add controls
                AddControls();

                //add buttons to the top right beside control buttons
                //AddActiveButtons();

                _initialized = true;
                this.Cursor  = Cursors.Default;
                Logger.Add("Initialized all controls", "Main Form");

                loadingPanel.Visible = false;
            });

            //update problem database if not available
            if (LocalDirectory.GetFileSize(LocalDirectory.GetProblemInfoFile()) < 100)
            {
                while (!_initialized)
                {
                    System.Threading.Thread.Sleep(1000);
                }
                System.Threading.Thread.Sleep(2000);
                this.BeginInvoke((MethodInvoker) delegate
                {
                    UVA_Arena.Internet.Downloader.DownloadProblemDatabase();
                });
            }

            //update user submissions if not available
            if (LocalDatabase.ContainsUser(RegistryAccess.DefaultUsername))
            {
                string file = LocalDirectory.GetUserSubPath(RegistryAccess.DefaultUsername);
                if (LocalDirectory.GetFileSize(file) < 50)
                {
                    System.Threading.Thread.Sleep(1000);
                    this.BeginInvoke((MethodInvoker) delegate
                    {
                        Interactivity.userstat.DownloadUserSubs(RegistryAccess.DefaultUsername);
                    });
                }
            }

            //check for updates
            System.Threading.Thread.Sleep(10000);
            UpdateCheck.CheckForUpdate();
        }