/// <summary> /// Resumes the specified wrokers. /// </summary> /// <param name="wait">if set to <c>true</c> waits for the operation to complete.</param> /// <param name="read">if set to <c>true</c> executes the opration on the reading worker.</param> /// <param name="decode">if set to <c>true</c> executes the opration on the decoding worker.</param> /// <param name="render">if set to <c>true</c> executes the opration on the rendering worker.</param> public void Resume(bool wait, bool read, bool decode, bool render) { if (IsDisposed) { return; } var tasks = new Task[(read ? 1 : 0) + (decode ? 1 : 0) + (render ? 1 : 0)]; var index = 0; if (read) { tasks[index] = Reading.ResumeAsync(); index++; } if (decode) { tasks[index] = Decoding.ResumeAsync(); index++; } if (render) { tasks[index] = Rendering.ResumeAsync(); } if (wait) { Task.WaitAll(tasks); } }