private void FinishButton_Click(object sender, EventArgs e) { if (_elevator.PersonsList.Count == 0) { Result result = new Result(); _elevator.SendResult(result); timer.Enabled = false; ResultForm resultForm = new ResultForm(TimeBox.Text, result); resultForm.Show(); Close(); } else { ErrorLabel.ForeColor = Color.Red; } }
private string ShowTime(Time time) { string box; if (time.Ms < 10) { box = time.Ms.ToString(); } else { time.Ms = 0; time.Sec++; box = time.Ms.ToString(); } //sec if (time.Sec < 60) { if (time.Sec < 10) { box = "0" + time.Sec.ToString() + ":" + box; } else { box = time.Sec.ToString() + ":" + box; } } else { time.Sec = 0; time.Min++; box = "0" + time.Sec.ToString() + ":" + box; } //min if (time.Min < 60) { if (time.Min < 10) { box = "0" + time.Min.ToString() + ":" + box; } else { box = time.Min.ToString() + ":" + box; } } else { time.Min = 0; time.H++; box = "0" + time.Min.ToString() + ":" + box; } //house if (time.H < 24) { if (time.H < 10) { box = "0" + time.H.ToString() + ":" + box; } else { box = time.H.ToString() + ":" + box; } } else { Result result = new Result(); _elevator.SendResult(result); timer.Enabled = false; Hide(); ResultForm resultForm = new ResultForm(TimeBox.Text, result); resultForm.Show(); } return(box); }