Example #1
0
        public MusicOperationResult Dequeue(out MusicItem item)
        {
            lock (Queue) {
                if (Queue.Count == 0)
                {
                    item = null;
                    return(MusicOperationResult.QueueIsEmpty);
                }

                item = Queue.ElementAt(0);
                Queue.RemoveAt(0);
                return(MusicOperationResult.Success);
            }
        }
Example #2
0
        public MusicOperationResult Enqueue(MusicItem item)
        {
            lock (Queue) {
                if (Queue.Count >= Queue.Capacity)
                {
                    return(MusicOperationResult.QueueFull);
                }

                else
                {
                    Queue.Add(item);
                    return(MusicOperationResult.Success);
                }
            }
        }
Example #3
0
 public MusicOperationResult Remove(int index, out MusicItem item)
 {
     lock (Queue) {
         if (index < 0 || index >= Queue.Count)
         {
             item = null;
             return(MusicOperationResult.NotEnoughTrack);
         }
         else
         {
             item = Queue [index];
             Queue.RemoveAt(index);
             return(MusicOperationResult.Success);
         }
     }
 }