private void TMR_Question_Tick(object sender, EventArgs e) { int remainingTime = int.Parse(LBL_QuestionTime.Text); if (remainingTime >= 0) { if (remainingTime <= 5) { LBL_QuestionTime.ForeColor = Color.Red; if (remainingTime == 0) { TMR_Question.Stop(); sSave(); QuestionIndex += 1; sGetNextQuestion(QuestionIndex); TMR_Question.Start(); } else { LBL_QuestionTime.Text = (remainingTime - 1).ToString(); } } else { LBL_QuestionTime.Text = (remainingTime - 1).ToString(); } } }
//======================================================= //Service provided by Telerik (www.telerik.com) //Conversion powered by NRefactory. //Twitter: @telerik //Facebook: facebook.com/telerik //======================================================= private void FRM_Exam_Load(object sender, EventArgs e) { try { QuestionIndex = 0; sFillQuestionList(); sGetNextQuestion(QuestionIndex); int vQuestionCount = questionsList.Count; decimal remTime = decimal.Parse((vQuestionCount * 0.5).ToString()); int var = (int)remTime; int minutes = var; int seconds = (int)((remTime - minutes) * 60); LBL_QuestionTime.Text = "30"; LBL_ExamRemainingTime.Text = "00" + ":" + minutes + ":" + seconds; TMR_Question.Start(); Timer_ExamTime.Enabled = true; Timer_ExamTime.Start(); VoteTime = new TimeSpan(0, 0, minutes, seconds); } catch (Exception ex) { ExceptionHandler.HandleException(ex.Message, "FRM_Exam", "FRM_Exam_Load"); } }