Пример #1
0
 private void CheckServer()
 {
     LoginButton.Enabled       = false;
     AddNewUsersButton.Visible = false;
     examButtons.ForEach(u => u.Hide());
     WebRequest.Check((res) =>
     {
         ServerLabel.Text      = WebRequest.GetDomain();
         ServerLabel.ForeColor = res.IsSucces() ? Color.Black : Color.Red;
         if (res.IsSucces())
         {
             VersionLabel.Text = "v" + VersionController.GetLocalVersion().Client;
             VersionController.SetOnlineVersion(JsonConvert.DeserializeObject <Version>(res.ToString()));
             if (VersionController.CheckVersion() == DialogResult.Yes)
             {
                 Process.Start(WebRequest.GetDownloadString());
             }
             setState(FormState.Login);
         }
         else
         {
             MessageBox.Show("The exam server is currently unaviable! Check your internet status, and try again!", "Server is offline", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Close();
         }
     });
 }
Пример #2
0
        public MainForm()
        {
            InitializeComponent();
            VersionController = new VersionController();
            InitLocalizator();

            examButtons = new List <Button>(); moderatorButtons = new List <Button>();
            examButtons.Add(ExamStartButton); examButtons.Add(ExamStatisticButton);
            moderatorButtons.Add(ExamNewButton); moderatorButtons.Add(AddNewUsersButton);
        }