/// <summary> /// Gets the named registered task from the collection. /// </summary> /// <param name="name"> The name of the registered task to be retrieved. </param> /// <returns> A <see cref="Task" /> instance that contains the requested context. </returns> public Task this[string name] { get { if (v2Coll != null) { return(new Task(svc, v2Coll[name])); } var v1Task = svc.GetTask(name); if (v1Task != null) { return(v1Task); } throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Gets the specified running task from the collection. /// </summary> /// <param name="index"> The index of the running task to be retrieved. </param> /// <returns> A <see cref="RunningTask" /> instance. </returns> public RunningTask this[int index] { get { if (v2Coll != null) { var irt = v2Coll[++index]; return(new RunningTask(svc, TaskService.GetTask(svc.v2TaskService, irt.Path), irt)); } var i = 0; var v1te = new V1RunningTaskEnumerator(svc); while (v1te.MoveNext()) { if (i++ == index) { return(v1te.Current); } } throw new ArgumentOutOfRangeException(); } }