Added playlist view and initial playlist view logic.

This commit is contained in:
2025-03-10 09:50:05 -04:00
parent 9890236710
commit bd9b30abbd
19 changed files with 619 additions and 20 deletions

View File

@@ -0,0 +1,28 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data.Converters;
using Harmonia.Core.Player;
using System;
using System.Globalization;
namespace Harmonia.UI.Converters;
public class RepeatStateToIconConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not RepeatState repeatMode)
return null;
string resourceName = repeatMode == RepeatState.RepeatOne
? "RepeatOneIcon"
: "RepeatIcon";
return Application.Current?.FindResource(resourceName);
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -0,0 +1,37 @@
using Avalonia.Controls;
using Avalonia.Data.Converters;
using Avalonia;
using Harmonia.UI.Models;
using System;
using System.Globalization;
using Harmonia.Core.Playlists;
namespace Harmonia.UI.Converters;
public class VolumeStateToIconConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not VolumeState volumeState)
return AvaloniaProperty.UnsetValue;
return Application.Current?.FindResource($"Volume{volumeState}Icon") ?? AvaloniaProperty.UnsetValue;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException();
}
public class PlaylistSongEqualityConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is PlaylistSong playingSong && parameter is PlaylistSong currentSong)
{
return playingSong == currentSong;
}
return false;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException();
}