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); } }
public MusicOperationResult Enqueue(MusicItem item) { lock (Queue) { if (Queue.Count >= Queue.Capacity) { return(MusicOperationResult.QueueFull); } else { Queue.Add(item); return(MusicOperationResult.Success); } } }
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); } } }