Example #1
0
        protected virtual bool CheckIfCancelRequest()
        {
            if (_requestDoing != null)
            {
                if (_requestCancelSource.Token.IsCancellationRequested)
                {
                    RequestsRejected.Add(_requestDoing);
                    _requestDoing = null;

                    if (PauseOnReject)
                    {
                        IsPaused = true;
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #2
0
        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;
        }
Example #3
0
 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);
 }