Ejemplo n.º 1
0
        //------------------------------------------------------------------------------------------------------------------------
        #endregion


        #region Functions
        //------------------------------------------------------------------------------------------------------------------------
        void callbackLanding(RequestInfo req)
        {
            // check if the request is canceled
            if (req.IsCanceled)
            {
                return;
            }

            // check if the Event is infinitely repeatable
            if (req.IsInfinitelyRepeatable)
            {
                SleepRequests.Enqueue(callbackLanding, req, req.Interval);
            }

            else
            {
                // resubmit timer if count > 0
                req.Count--;
                if (req.Count > 0)
                {
                    SleepRequests.Enqueue(callbackLanding, req, req.Interval);
                }
            }

            //tick handler
            Task.Run(() =>
            {
                try
                {
                    req.Callback(req.UserData);
                }
                catch (Exception ex) { DebugEx.TraceErrorException(ex); }
            });
        }