private void timer1_Tick(object sender, EventArgs e) { double errorsCount = stats.Missed; double maxErrorsCount = exercise.maxErrors; int assigment = (int)(5 * (1 - errorsCount / maxErrorsCount)); if (index < list.Count && listBox1.Items.Count < 4) { listBox1.Items.Add(list[index]); index++; } if (stats.Missed >= exercise.maxErrors) { listBox1.Items.Clear(); listBox1.Items.Add("Game over"); isRuning = false; timer1.Stop(); watch.Stop(); watch.Reset(); Session.CurrentResultInfo = new ExerciseResultInfo(exercise, new DateTime(), stats.Missed, assigment, watch.Elapsed.Seconds); Int32 command = 0; ExeciseResult execiseResult = new ExeciseResult(); execiseResult.ShowDialog(); if( command == 1){ clearAll(); } if (command == 2) { this.Close(); } } if (stats.Correct == list.Count) { listBox1.Items.Clear(); listBox1.Items.Add("Win!!!!"); timer1.Stop(); watch.Stop(); isRuning = false; Session.CurrentResultInfo = new ExerciseResultInfo(exercise, new DateTime(), stats.Missed, assigment, watch.Elapsed.Seconds); ExeciseResult execiseResult = new ExeciseResult(); execiseResult.ShowDialog(); int command = execiseResult.getCommand(); execiseResult.Close(); if (command == 1) { clearAll(); } if (command == 2) { this.Close(); } } }
private void timer1_Tick(object sender, EventArgs e) { double errorsCount = stats.Missed; double maxErrorsCount = exercise.maxErrors; int assigment = (int)(5 * (1 - errorsCount / maxErrorsCount)); if (index < list.Count && listBox1.Items.Count < 4) { listBox1.Items.Add(list[index]); index++; } if (stats.Missed >= exercise.maxErrors) { listBox1.Items.Clear(); listBox1.Items.Add("Game over"); isRuning = false; timer1.Stop(); watch.Stop(); watch.Reset(); Session.CurrentResultInfo = new ExerciseResultInfo(exercise, new DateTime(), stats.Missed, assigment, watch.Elapsed.Seconds); Int32 command = 0; ExeciseResult execiseResult = new ExeciseResult(); execiseResult.ShowDialog(); if (command == 1) { clearAll(); } if (command == 2) { this.Close(); } } if (stats.Correct == list.Count) { listBox1.Items.Clear(); listBox1.Items.Add("Win!!!!"); timer1.Stop(); watch.Stop(); isRuning = false; Session.CurrentResultInfo = new ExerciseResultInfo(exercise, new DateTime(), stats.Missed, assigment, watch.Elapsed.Seconds); ExeciseResult execiseResult = new ExeciseResult(); execiseResult.ShowDialog(); int command = execiseResult.getCommand(); execiseResult.Close(); if (command == 1) { clearAll(); } if (command == 2) { this.Close(); } } }