private void btnFinish_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you really want to close me?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { var DBoard = this.Parent as Dashboard; ChronomiterTimer.Stop(); Hide(); SendExam.LastExamFromSQL(); DBoard.processExam.Start(); DBoard.processExam.Show(); } }
private void ChronomiterTimer_Tick(object sender, EventArgs e) { s = s - 1; sBar = sBar + 1; if (s == -1) { m = m - 1; s = 59; } if (m == -1) { h = h - 1; m = 59; } if (h == 0 && m == 0 && s == 0) { ChronomiterTimer.Stop(); //END of Time Hide(); var DBoard = this.Parent as Dashboard; DBoard.processExam.Start(); DBoard.processExam.Show(); SendExam.LastExamFromSQL(); } string hh = Convert.ToString(h); string mm = Convert.ToString(m); string ss = Convert.ToString(s); int ssBar = (sBar * 100) / 3600; if (h == 0) { lblCountTime.Text = String.Format("0{0}:{1}:{2}", hh, mm, ss); } if (h == 0 && m < 0) { lblCountTime.Text = String.Format("0{0}:0{1}:{2}", hh, mm, ss); } if (h == 0 && s < 10) { lblCountTime.Text = String.Format("0{0}:{1}:0{2}", hh, mm, ss); } if (h == 0 && m < 10) { lblCountTime.Text = String.Format("0{0}:0{1}:{2}", hh, mm, ss); } if (h == 0 && m < 10 && s < 10) { lblCountTime.Text = String.Format("0{0}:0{1}:0{2}", hh, mm, ss); } pBarProgress.Value = ssBar; }