Example #1
0
        /// <summary>Add a row to the ListView.</summary>
        /// <param name="job">The job to use to populate the row.</param>
        private void AddRowToJobListView(JobDetails job)
        {
            if (!showMyJobsOnlyCheckbox.Checked ||
                string.Equals(job.Owner, Environment.UserName, StringComparison.InvariantCultureIgnoreCase))
            {
                filteredJobList.Add(job);
                string startTime = null;
                string endTime   = null;
                if (job.StartTime != null)
                {
                    startTime = ((DateTime)job.StartTime).ToLocalTime().ToString(dateFormat);
                }
                if (job.EndTime != null)
                {
                    endTime = ((DateTime)job.EndTime).ToLocalTime().ToString(dateFormat);
                }

                jobListView.AddRow(new object[]
                {
                    job.DisplayName,
                    job.Owner,
                    job.State,
                    job.NumSims.ToString(),
                    job.Progress.ToString("F0"),
                    startTime,
                    endTime,
                    job.Duration().ToString(timespanFormat),
                    job.CpuTime.ToString(timespanFormat)
                });
            }
        }