Example #1
0
        public void AddToQueue(string title, string URL)
        {
            QueueObject newObj = new QueueObject(title, URL);

            ToDownloadQueue.Enqueue(newObj);

            //Console.WriteLine("DownloadQueue.AddToQueue(): adding obj to queue");

            OnAddedToQueue();
            OnQueueChange();
        }
Example #2
0
        /// <summary>
        /// Swaps two items in the queue
        /// </summary>
        /// <param name="index">QueueObject to be swapped with target</param>
        /// <param name="target">QueueObject to be swapped with index</param>
        public void SwapInQueue(int index, int target)
        {
            QueueObject[] QueueArray = new QueueObject[ToDownloadQueue.Count];
            ToDownloadQueue.CopyTo(QueueArray, 0);

            QueueObject temp = QueueArray[index];

            QueueArray[index]  = QueueArray[target];
            QueueArray[target] = temp;

            //remake queue
            OnQueueChange();
            ToDownloadQueue = new Queue <QueueObject>(QueueArray);            //could this make a problem?
        }
Example #3
0
 //makes an array from the queue and returns the index
 public QueueObject ExtractFromQueue(int index)
 {
     QueueObject[] QueueArray = new QueueObject[ToDownloadQueue.Count];
     ToDownloadQueue.CopyTo(QueueArray, 0);
     return(QueueArray[index]);
 }