/// <summary> /// Adds a new render task. /// </summary> /// <param name="owner">The owner. This is any object that is able to uniquely identify the render task.</param> /// <param name="doc">The graph document to render.</param> /// <param name="renderingAction">The rendering action. This action is called when the provided graph document should be rendered.</param> public void AddTask(object owner, GraphDocument doc, Action <GraphDocument, object> renderingAction) { var task = new GraphDocumentRenderTask(this, owner, doc, renderingAction); _tasksWaiting.TryAddLast(owner, task); TryStartWaitingTasks(); }
/// <summary> /// The render task calls back this function when it is finished. /// It removes the render task from the list of currently rendering tasks. If the task was not successfully finished and /// more trials are allowed, the render task is put back at the end of the list of waiting rendering tasks. /// </summary> /// <param name="rendering">The rendering task that was just finished.</param> private void EhRenderTaskFinished(GraphDocumentRenderTask rendering) { _tasksRendering.TryRemove(rendering.Document, out var renderTask); if (!renderTask.WasSuccessful && renderTask.MoreTrialsAllowed) { _tasksWaiting.TryAddLast(renderTask.Owner, renderTask); } TryStartWaitingTasks(); }