public fMain() { InitializeComponent(); ChemTest.ReadSettings(); if (!ChemTest.rememberPassword) { fLogin fl = new fLogin(); if (fl.ShowDialog() == DialogResult.Cancel) { Close(); Application.Exit(); } } fe = new fExam(false); ft = new fTraining(); fs = new fSettings(); pbLogo.Image = Image.FromFile(@"sys\img\chemtest logo light blue.png"); pbBackground.Image = Image.FromFile(@"sys\img\background.jpg"); bExam.Image = Image.FromFile(@"sys\img\btn\exam.png"); bTraining.Image = Image.FromFile(@"sys\img\btn\training.png"); btnAddQuestions.Image = Image.FromFile(@"sys\img\btn\add-test.png"); bSettings.Image = Image.FromFile(@"sys\img\btn\settings.png"); bHowToUse.Image = Image.FromFile(@"sys\img\btn\question.png"); bAboutUs.Image = Image.FromFile(@"sys\img\btn\info.png"); bExit.Image = Image.FromFile(@"sys\img\btn\exit.png"); btnBackToMenu.Image = Image.FromFile(@"sys\img\btn\back-small.png"); btnNewTest.Image = Image.FromFile(@"sys\img\btn\add-test.png"); btnEditTest.Image = Image.FromFile(@"sys\img\btn\edit-test.png"); }
public fLogin() { InitializeComponent(); ChemTest.ReadSettings(); btnTeacher.Image = Image.FromFile(@"sys\img\btn\teacher.png"); btnStudent.Image = Image.FromFile(@"sys\img\btn\student.png"); btnOK.BackgroundImage = Image.FromFile(@"sys\img\btn\next.png"); }
private void bOk_Click(object sender, EventArgs e) { ChemTest.examDuration = Convert.ToInt32(cbExamDuration.Text); ChemTest.shuffleQuest = cbRandomQuest.Checked; ChemTest.shuffleAnsw = cbRandomAnsw.Checked; ChemTest.isTeacher = (lblUserType.Text == "Вчитель"); ChemTest.name = tbxName.Text; ChemTest.teacherPassword = tbxPassword.Text; ChemTest.rememberPassword = cbRemember.Checked; ChemTest.WriteSettings(); Hide(); }
private void bTraining_Click(object sender, EventArgs e) { fSelectTest st = new fSelectTest(false); DialogResult stdr = st.ShowDialog(); if (stdr == DialogResult.OK) { ft.q = st.selectedQuestions; ft.ShowDialog(); } else if (stdr == DialogResult.Abort) { fe = new fExam(true); fe.q = st.selectedQuestions; fe.ShowDialog(); } Show(); ChemTest.ReadSettings(); fe = new fExam(false); ft = new fTraining(); }
private void btnOK_Click(object sender, EventArgs e) { ChemTest.name = tbxName.Text; ChemTest.rememberPassword = cbRemember.Checked; if (tbxPassword.Visible) { if (tbxPassword.Text == ChemTest.teacherPassword) { ChemTest.WriteSettings(); DialogResult = DialogResult.OK; } else { MessageBox.Show("Ви ввели неправильний пароль.", "Неправильний пароль", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { DialogResult = DialogResult.OK; } Close(); }
private void btnResetToDefaults_Click(object sender, EventArgs e) { if (MessageBox.Show("Ви впевнені, що хочете забути всі налаштування? Всі ваші дані, паролі та налаштування буде скинуто до початкового стану!", "Увага!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { string regKeyName = @"Software\Atomus\ChemTest"; RegistryKey rk = null; try { rk = Registry.CurrentUser.CreateSubKey(regKeyName); if (rk == null) { return; } rk.SetValue("ExamDuration", 10); rk.SetValue("ShuffleQuestions", false); rk.SetValue("ShuffleAnswers", false); rk.SetValue("IsTeacher", false); rk.SetValue("Name", "Користувач"); rk.SetValue("Password", "1234"); rk.SetValue("RememberPassword", false); rk.SetValue("IsFirstStartup", false); rk.SetValue("QuestionsFolder", Application.StartupPath + @"\sys\questions"); rk.SetValue("ImagesFolder", Application.StartupPath + @"\sys\img"); } finally { if (rk != null) { rk.Close(); } } ChemTest.ReadSettings(); SetDefault(); Application.Exit(); } }