/// <summary> /// Given a job, return the index in the visible job list that matches the job. /// Uses the job guid as the key. /// </summary> /// <param name="job">The IBackgroundCopyJob to look for</param> /// <returns>An index 0..n for a job that's found and -1 if not found</returns> private int GetJobIndex(BITS.IBackgroundCopyJob job) { BITS.GUID searchFor; job.GetId(out searchFor); for (int i = 0; i < _uiJobList.Items.Count; i++) { var control = _uiJobList.Items[i] as JobViewControl; BITS.GUID id; control.Job.GetId(out id); if (searchFor.GuidEquals(id)) { return(i); } } return(-1); }