Added ContextMenu/Flyout animations. Added platform services. Use bitmap cache for all views.
This commit is contained in:
@@ -68,7 +68,7 @@ public class AudioImageExtractor : IAudioImageExtractor
|
||||
if (string.IsNullOrWhiteSpace(imagePath))
|
||||
return null;
|
||||
|
||||
return await SongPictureInfo.FromFileAsync(path, cancellationToken);
|
||||
return await SongPictureInfo.FromFileAsync(imagePath, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ public class Playlist
|
||||
if (IsLocked)
|
||||
return;
|
||||
|
||||
if (playlistSongs.Length == 0)
|
||||
return;
|
||||
|
||||
int insertIndex = index ?? Songs.Count;
|
||||
|
||||
Songs.InsertRange(insertIndex, playlistSongs);
|
||||
@@ -158,4 +161,54 @@ public class Playlist
|
||||
|
||||
PlaylistUpdated?.Invoke(this, eventArgs);
|
||||
}
|
||||
|
||||
public void ImportTags(Song[] songs)
|
||||
{
|
||||
foreach (Song song in songs)
|
||||
{
|
||||
PlaylistSong[] playlistSongs = [.. Songs.Where(playlistSong =>
|
||||
string.Equals(playlistSong.Song.FileName, song.FileName, StringComparison.OrdinalIgnoreCase))];
|
||||
|
||||
foreach (PlaylistSong playlistSong in playlistSongs)
|
||||
{
|
||||
//playlistSong.Song = song;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveMissingSongs()
|
||||
{
|
||||
PlaylistSong[] missingSongs = [.. Songs.Where(playlistSong =>
|
||||
File.Exists(playlistSong.Song.FileName) == false)];
|
||||
|
||||
if (missingSongs.Length == 0)
|
||||
return;
|
||||
|
||||
RemoveSongs(missingSongs);
|
||||
}
|
||||
|
||||
public void RemoveDuplicateSongs()
|
||||
{
|
||||
List<PlaylistSong> songsToRemove = [];
|
||||
|
||||
string[] fileNames = Songs
|
||||
.GroupBy(x => x.Song.FileName)
|
||||
.Where(x => x.Count() > 1)
|
||||
.Select(x => x.Key)
|
||||
.ToArray();
|
||||
|
||||
foreach (string fileName in fileNames)
|
||||
{
|
||||
List<PlaylistSong> songs = Songs.Where(x =>
|
||||
string.Equals(x.Song.FileName, fileName, StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
for (int i = songs.Count - 1; i > 0; i--)
|
||||
songsToRemove.Add(songs[i]);
|
||||
}
|
||||
|
||||
if (songsToRemove.Count == 0)
|
||||
return;
|
||||
|
||||
RemoveSongs(songsToRemove.ToArray());
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,9 @@ public class PlaylistRepository : JsonFileRepository<Playlist>, IPlaylistReposit
|
||||
{
|
||||
playlist.PlaylistUpdated += OnPlaylistUpdated;
|
||||
}
|
||||
|
||||
if (playlists.Count == 0)
|
||||
AddPlaylist();
|
||||
}
|
||||
|
||||
private void OnPlaylistUpdated(object? sender, PlaylistUpdatedEventArgs e)
|
||||
@@ -22,7 +25,6 @@ public class PlaylistRepository : JsonFileRepository<Playlist>, IPlaylistReposit
|
||||
return;
|
||||
|
||||
Save(playlist);
|
||||
//PlaylistUpdated?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public Playlist? GetPlaylist(PlaylistSong playlistSong)
|
||||
@@ -45,7 +47,6 @@ public class PlaylistRepository : JsonFileRepository<Playlist>, IPlaylistReposit
|
||||
}
|
||||
|
||||
public event EventHandler<PlaylistAddedEventArgs>? PlaylistAdded;
|
||||
//public event EventHandler<PlaylistUpdatedEventArgs>? PlaylistUpdated;
|
||||
public event EventHandler<PlaylistRemovedEventArgs>? PlaylistRemoved;
|
||||
|
||||
public void AddPlaylist()
|
||||
|
||||
Reference in New Issue
Block a user