Wire up disc changing to UI

This commit is contained in:
Matt Nadareski
2021-10-05 10:40:10 -07:00
parent 7b01715a11
commit 211ee8cecf
10 changed files with 181 additions and 91 deletions

View File

@@ -44,6 +44,15 @@ namespace RedBookPlayer.GUI.ViewModels
#region OpticalDisc Passthrough
/// <summary>
/// Path to the disc image
/// </summary>
public string ImagePath
{
get => _imagePath;
private set => this.RaiseAndSetIfChanged(ref _imagePath, value);
}
/// <summary>
/// Current track number
/// </summary>
@@ -159,6 +168,7 @@ namespace RedBookPlayer.GUI.ViewModels
/// </summary>
public ulong TotalTime => _player.TotalTime;
private string _imagePath;
private int _currentTrackNumber;
private ushort _currentTrackIndex;
private ushort _currentTrackSession;
@@ -274,6 +284,16 @@ namespace RedBookPlayer.GUI.ViewModels
/// </summary>
public ReactiveCommand<Unit, Unit> EjectCommand { get; }
/// <summary>
/// Command for moving to the next disc
/// </summary>
public ReactiveCommand<Unit, Unit> NextDiscCommand { get; }
/// <summary>
/// Command for moving to the previous disc
/// </summary>
public ReactiveCommand<Unit, Unit> PreviousDiscCommand { get; }
/// <summary>
/// Command for moving to the next track
/// </summary>
@@ -359,6 +379,8 @@ namespace RedBookPlayer.GUI.ViewModels
TogglePlayPauseCommand = ReactiveCommand.Create(ExecuteTogglePlayPause);
StopCommand = ReactiveCommand.Create(ExecuteStop);
EjectCommand = ReactiveCommand.Create(ExecuteEject);
NextDiscCommand = ReactiveCommand.Create(ExecuteNextDisc);
PreviousDiscCommand = ReactiveCommand.Create(ExecutePreviousDisc);
NextTrackCommand = ReactiveCommand.Create(ExecuteNextTrack);
PreviousTrackCommand = ReactiveCommand.Create(ExecutePreviousTrack);
NextIndexCommand = ReactiveCommand.Create(ExecuteNextIndex);
@@ -819,8 +841,17 @@ namespace RedBookPlayer.GUI.ViewModels
});
}
ImagePath = _player.ImagePath;
Initialized = _player.Initialized;
if (!string.IsNullOrWhiteSpace(ImagePath) && Initialized)
{
Dispatcher.UIThread.InvokeAsync(() =>
{
App.MainWindow.Title = "RedBookPlayer - " + ImagePath.Split('/').Last().Split('\\').Last();
});
}
CurrentDisc = _player.CurrentDisc;
CurrentTrackNumber = _player.CurrentTrackNumber;
CurrentTrackIndex = _player.CurrentTrackIndex;