Exemplo n.º 1
0
        private void Init()
        {
            Height                 = 228;
            Width                  = 473;
            LoginGrid.Margin       = new Thickness(10, 10, 0, 0);
            ContentGrid.Margin     = new Thickness(10, 10, 0, 0);
            ContentGrid.Opacity    = 0;
            LoginGrid.Visibility   = Visibility.Visible;
            ContentGrid.Visibility = Visibility.Hidden;

            Configuration.Init();
            Connection.Init(UpdateListBoxContent);
            UserHelper.SetCurrentUser(0, string.Empty, string.Empty, string.Empty, 0, string.Empty, string.Empty);
            UserHelper.CurrentUser.IsChanged = false;
            ShowUserInfo();

            UpdateListBoxContent($"{DateTime.Now:yyyy/MM/dd HH:mm:ss} 欢迎使用 hjudge", null, false);

            Task.Run(() =>
            {
                while (!Connection.IsExited)
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        CurrentJudgeList.Content = "当前评测线程数量:" + Connection.CurJudgingCnt;
                    }));
                    Thread.Sleep(500);
                }
            });

            Connection.ActionExecuter(OverLoad);

            new Thread(UpdateUITask).Start();
            new Thread(UpdateState).Start();
        }