/// <summary> /// Adds the work item to the queue /// </summary> /// <param name="workItem"></param> public void AddItemToQueue(IExecutableWorkItem workItem) { try { // add item to queue, then increment counter WorkItemQ.Enqueue(workItem); m_ItemsInQueue++; } catch (Exception excep) { MyScheduleEngine.AddExceptionToQueue(excep); } }
/// <summary> /// Adds the item to the scheduled queue /// </summary> /// <param name="workItem"></param> public void AddScheduledItem(IExecutableWorkItem workItem) { try { // get the execution time in milliseconds double TotalMs = new TimeSpan(workItem.ExecutionTime.Ticks - DateTime.Now.Ticks).TotalMilliseconds; // need to check execution time before adding to q if (TotalMs <= FastTimeMs) FastSched.AddItemToQueue(workItem); else if (TotalMs <= SlowTimeMs) SlowSched.AddItemToQueue(workItem); else SnailSched.AddItemToQueue(workItem); } catch (Exception excep) { AddExceptionToQueue(excep); } }