private void OnTimerTick(object sender, EventArgs e)
        {
            try
            {
                Total.Text        = _JobRunner.Jobs.Count.ToString();
                ProgressBar.Value = _JobRunner.PercentageComplete;

                int NumCompleted;
                int NumWithErrors;
                int NumWithWarnings;
                _JobRunner.CalcStats(out NumCompleted, out NumWithErrors, out NumWithWarnings);
                Completed.Text          = NumCompleted.ToString();
                NumberWithErrors.Text   = NumWithErrors.ToString();
                NumberWithWarnings.Text = NumWithWarnings.ToString();

                if (ProgressBar.Value >= 100 && !this.Text.Contains("100% complete"))
                {
                    string WavFileName = Configuration.Instance.Setting("ApsimFinishedWAVFileName");
                    if (File.Exists(WavFileName))
                    {
                        System.Media.SoundPlayer Player = new System.Media.SoundPlayer(WavFileName);
                        Player.Play();
                    }
                    ShowDetailButton.Visible = true;
                    Timer1.Enabled           = false;
                    PerformanceSeries.Clear();
                    if (AutoClose)
                    {
                        // pause for 5 sec to make sure Windows has finished writing everything to stdout.
                        Thread.Sleep(5000);
                        Close();
                    }
                }
                this.Text = ProgressBar.Value.ToString() + "% complete";
                if (PauseButton.Checked)
                {
                    this.Text += " - Paused";
                }
                if (StopButton.Checked)
                {
                    this.Text += " - Aborted";
                }

                if (PerformanceCounter != null)
                {
                    Array.Copy(values, 1, values, 0, 9);
                    values[9] = PerformanceCounter.NextValue();
                    PerformanceSeries.Clear();
                    PerformanceSeries.Add(values);
                }
            }
            catch
            {
            }
        }