Added logic for tags and audio engine.
This commit is contained in:
43
Harmonia.Core/Playlists/PlaylistManager.cs
Normal file
43
Harmonia.Core/Playlists/PlaylistManager.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using Harmonia.Core.Data;
|
||||
|
||||
namespace Harmonia.Core.Playlists;
|
||||
|
||||
public class PlaylistManager(IRepository<Playlist> playlistRepository) : IPlaylistManager
|
||||
{
|
||||
private Playlist? _currentPlaylist;
|
||||
public Playlist? CurrentPlaylist
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentPlaylist;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currentPlaylist = value;
|
||||
CurrentPlaylistChanged?.Invoke(this, new());
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler? CurrentPlaylistChanged;
|
||||
public event EventHandler<PlaylistAddedEventArgs>? PlaylistAdded;
|
||||
public event EventHandler<PlaylistRemovedEventArgs>? PlaylistRemoved;
|
||||
|
||||
public void AddPlaylist()
|
||||
{
|
||||
Playlist playlist = new()
|
||||
{
|
||||
Name = "New Playlist"
|
||||
};
|
||||
|
||||
playlistRepository.Save(playlist);
|
||||
|
||||
PlaylistAdded?.Invoke(this, new(playlist));
|
||||
}
|
||||
|
||||
public void RemovePlaylist(Playlist playlist)
|
||||
{
|
||||
playlistRepository.Delete(playlist);
|
||||
|
||||
PlaylistRemoved?.Invoke(this, new(playlist));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user