From 23853a1bf618410aa2c67dd4aff2143171a2b8ff Mon Sep 17 00:00:00 2001 From: Royce551 Date: Mon, 8 Mar 2021 20:04:44 -0600 Subject: [PATCH] some xmldoc --- .../FRESHMusicPlayer.Player/PlayQueue.cs | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/FRESHMusicPlayer.Player/FRESHMusicPlayer.Player/PlayQueue.cs b/FRESHMusicPlayer.Player/FRESHMusicPlayer.Player/PlayQueue.cs index b537fe1..377f0d6 100644 --- a/FRESHMusicPlayer.Player/FRESHMusicPlayer.Player/PlayQueue.cs +++ b/FRESHMusicPlayer.Player/FRESHMusicPlayer.Player/PlayQueue.cs @@ -4,8 +4,15 @@ using System.Text; namespace FRESHMusicPlayer { + /// + /// Represents the player's queue. + /// public class PlayQueue { + /// + /// Gets or sets the current queue. This is settable for situations where there's no method for what you want to do. + /// Use the methods in this class for managing the queue so that events can fire and stuff doesn't break in the future. + /// public List Queue { get @@ -26,6 +33,9 @@ namespace FRESHMusicPlayer } private bool shuffle = false; + /// + /// Gets or sets whether the queue should be shuffled. + /// public bool Shuffle { get => shuffle; @@ -36,9 +46,17 @@ namespace FRESHMusicPlayer else shuffledQueue = null; } } + /// + /// Gets or sets the current repeat mode. + /// public RepeatMode RepeatMode { get; set; } = RepeatMode.None; + /// + /// Gets the index in the queue of the track that the Player is going to play *next*. + /// public int Position { get; internal set; } - + /// + /// Fired when the queue changes. + /// public event EventHandler QueueChanged; private List queue = new List(); @@ -46,6 +64,10 @@ namespace FRESHMusicPlayer private readonly Random rng = new Random(); + /// + /// Adds a track to the queue. + /// + /// The track to add public void Add(string filePath) { Queue.Add(filePath); @@ -53,6 +75,10 @@ namespace FRESHMusicPlayer ShuffleQueue(); QueueChanged?.Invoke(null, EventArgs.Empty); } + /// + /// Adds multiple tracks to the queue. + /// + /// The tracks to add. public void Add(string[] filePaths) { Queue.AddRange(filePaths); @@ -60,18 +86,28 @@ namespace FRESHMusicPlayer ShuffleQueue(); QueueChanged?.Invoke(null, EventArgs.Empty); } + /// + /// Clears the queue. + /// public void Clear() { Queue.Clear(); Position = 0; QueueChanged?.Invoke(null, EventArgs.Empty); } + /// + /// Shuffles the queue. If isn't true, this will not do anything. + /// public void ManualShuffle() { if (Shuffle) ShuffleQueue(); QueueChanged?.Invoke(null, EventArgs.Empty); } + /// + /// Removes a track from the queue. + /// + /// The index of the track you want to remove. public void Remove(int index) { if (index <= (Position - 1)) Position--; @@ -105,10 +141,22 @@ namespace FRESHMusicPlayer shuffledQueue = listtoreinsert; } } + /// + /// The way that the queue will be repeated + /// public enum RepeatMode { + /// + /// Do not repeat tracks in the queue + /// None, + /// + /// Repeat the currently playing track + /// RepeatOne, + /// + /// Repeat the entire queue + /// RepeatAll } }