protected virtual bool CheckIfCancelRequest() { if (_requestDoing != null) { if (_requestCancelSource.Token.IsCancellationRequested) { RequestsRejected.Add(_requestDoing); _requestDoing = null; if (PauseOnReject) { IsPaused = true; return(true); } } } return(false); }
protected virtual void ThreadMainCleanup() { while (RequestsToDo.Count > 0) { RequestsRejected.Add(RequestsToDo.Pop()); } if (_requestDoing != null) { RequestsRejected.Add(_requestDoing); } _requestDoing = null; if (_requestCancelSource != null) { _requestCancelSource.Dispose(); } _runThread = null; }
public virtual bool Add(GrblRequest request) { if (IsRunning) { if (request.IsValid) { if (request.IsSpecial) { SpecialRequests.Add(request); } else { RequestsToDo.Add(request); } return(true); } else if (SaveRejectedRequests) { RequestsRejected.Add(request); } } return(false); }