mirror of
https://github.com/aaru-dps/RedBookPlayer.git
synced 2025-12-16 19:24:41 +00:00
Wire up disc changing to UI
This commit is contained in:
@@ -75,6 +75,18 @@ namespace RedBookPlayer.GUI.ViewModels
|
||||
PlayerView?.ViewModel?.ExecuteEject();
|
||||
}
|
||||
|
||||
// Next Disc
|
||||
else if(e.Key == App.Settings.NextDiscKey)
|
||||
{
|
||||
PlayerView?.ViewModel?.ExecuteNextDisc();
|
||||
}
|
||||
|
||||
// Previous Disc
|
||||
else if(e.Key == App.Settings.PreviousDiscKey)
|
||||
{
|
||||
PlayerView?.ViewModel?.ExecutePreviousDisc();
|
||||
}
|
||||
|
||||
// Next Track
|
||||
else if(e.Key == App.Settings.NextTrackKey || e.Key == Key.MediaNextTrack)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -103,7 +103,8 @@
|
||||
<TextBlock Margin="0,0,16,0" IsVisible="{Binding QuadChannel}">4CH</TextBlock>
|
||||
<TextBlock Margin="0,0,16,0" Foreground="LightGray" IsVisible="{Binding !HiddenTrack}">HIDDEN</TextBlock>
|
||||
<TextBlock Margin="0,0,16,0" IsVisible="{Binding HiddenTrack}">HIDDEN</TextBlock>
|
||||
<TextBlock Margin="0,0,16,0" Text="{Binding Volume}"/>
|
||||
<TextBlock Margin="0,0,16,0" Text="{Binding Volume, StringFormat='Volume {0}%'}"/>
|
||||
<TextBlock Margin="0,0,16,0" Text="{Binding CurrentDisc, StringFormat='Disc Number: {0}'}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ReactiveUserControl>
|
||||
@@ -58,120 +58,144 @@
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Keyboard Bindings">
|
||||
<Grid Margin="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Margin="16">
|
||||
|
||||
<!-- Load Image-->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Width="120">Load Image</TextBlock>
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Name="LoadImageKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding LoadImageKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Load Image</TextBlock>
|
||||
<ComboBox Name="LoadImageKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding LoadImageKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Save Track -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Width="120">Save Track(s)</TextBlock>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Name="SaveTrackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding SaveTrackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Save Track(s)</TextBlock>
|
||||
<ComboBox Name="SaveTrackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding SaveTrackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Toggle Play/Pause -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Width="120">Toggle Play/Pause</TextBlock>
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" Name="TogglePlaybackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding TogglePlaybackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Toggle Play/Pause</TextBlock>
|
||||
<ComboBox Name="TogglePlaybackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding TogglePlaybackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Stop Playback-->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Width="120">Stop Playback</TextBlock>
|
||||
<ComboBox Grid.Row="3" Grid.Column="1" Name="StopPlaybackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding StopPlaybackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Stop Playback</TextBlock>
|
||||
<ComboBox Name="StopPlaybackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding StopPlaybackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Eject Disc-->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Width="120">Eject Disc</TextBlock>
|
||||
<ComboBox Grid.Row="4" Grid.Column="1" Name="EjectKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding EjectKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Eject Disc</TextBlock>
|
||||
<ComboBox Name="EjectKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding EjectKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Next Disc -->
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Next Disc</TextBlock>
|
||||
<ComboBox Name="NextDiscKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding NextDiscKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Previous Disc -->
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Previous Disc</TextBlock>
|
||||
<ComboBox Name="PreviousDiscKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding PreviousDiscKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Next Track -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Width="120">Next Track</TextBlock>
|
||||
<ComboBox Grid.Row="5" Grid.Column="1" Name="NextTrackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding NextTrackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Next Track</TextBlock>
|
||||
<ComboBox Name="NextTrackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding NextTrackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Previous Track -->
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Width="120">Previous Track</TextBlock>
|
||||
<ComboBox Grid.Row="6" Grid.Column="1" Name="PreviousTrackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding PreviousTrackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Previous Track</TextBlock>
|
||||
<ComboBox Name="PreviousTrackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding PreviousTrackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Next Index -->
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" Width="120">Next Index</TextBlock>
|
||||
<ComboBox Grid.Row="7" Grid.Column="1" Name="NextIndexKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding NextIndexKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Next Index</TextBlock>
|
||||
<ComboBox Name="NextIndexKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding NextIndexKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Previous Index -->
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Width="120">Previous Index</TextBlock>
|
||||
<ComboBox Grid.Row="8" Grid.Column="1" Name="PreviousIndexKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding PreviousIndexKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Previous Index</TextBlock>
|
||||
<ComboBox Name="PreviousIndexKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding PreviousIndexKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Fast Forward -->
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Width="120">Fast-Forward</TextBlock>
|
||||
<ComboBox Grid.Row="9" Grid.Column="1" Name="FastForwardPlaybackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding FastForwardPlaybackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Fast-Forward</TextBlock>
|
||||
<ComboBox Name="FastForwardPlaybackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding FastForwardPlaybackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Rewind -->
|
||||
<TextBlock Grid.Row="10" Grid.Column="0" Width="120">Rewind</TextBlock>
|
||||
<ComboBox Grid.Row="10" Grid.Column="1" Name="RewindPlaybackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding RewindPlaybackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Rewind</TextBlock>
|
||||
<ComboBox Name="RewindPlaybackKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding RewindPlaybackKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Volume Up -->
|
||||
<TextBlock Grid.Row="11" Grid.Column="0" Width="120">Volume Up</TextBlock>
|
||||
<ComboBox Grid.Row="11" Grid.Column="1" Name="VolumeUpKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding VolumeUpKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Volume Up</TextBlock>
|
||||
<ComboBox Name="VolumeUpKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding VolumeUpKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Volume Down -->
|
||||
<TextBlock Grid.Row="12" Grid.Column="0" Width="120">Volume Down</TextBlock>
|
||||
<ComboBox Grid.Row="12" Grid.Column="1" Name="VolumeDownKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding VolumeDownKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Volume Down</TextBlock>
|
||||
<ComboBox Name="VolumeDownKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding VolumeDownKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Mute Toggle -->
|
||||
<TextBlock Grid.Row="13" Grid.Column="0" Width="120">Toggle Mute</TextBlock>
|
||||
<ComboBox Grid.Row="13" Grid.Column="1" Name="ToggleMuteKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding ToggleMuteKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Toggle Mute</TextBlock>
|
||||
<ComboBox Name="ToggleMuteKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding ToggleMuteKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- De-Emphasis Toggle -->
|
||||
<TextBlock Grid.Row="14" Grid.Column="0" Width="120">Toggle De-Emphasis</TextBlock>
|
||||
<ComboBox Grid.Row="14" Grid.Column="1" Name="ToggleDeEmphasisKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding ToggleDeEmphasisKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</Grid>
|
||||
<WrapPanel Margin="0,0,0,16">
|
||||
<TextBlock Width="120">Toggle De-Emphasis</TextBlock>
|
||||
<ComboBox Name="ToggleDeEmphasisKeyBind"
|
||||
Items="{Binding KeyboardList}" SelectedItem="{Binding ToggleDeEmphasisKey, Mode=TwoWay}"
|
||||
HorizontalAlignment="Right" Margin="8,0,0,0" Width="120"/>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Button Name="ApplyButton" Command="{Binding ApplySettingsCommand}">Apply</Button>
|
||||
|
||||
@@ -103,7 +103,8 @@
|
||||
<TextBlock Margin="0,0,16,0" IsVisible="{Binding QuadChannel}">4CH</TextBlock>
|
||||
<TextBlock Margin="0,0,16,0" Foreground="LightGray" IsVisible="{Binding !HiddenTrack}">HIDDEN</TextBlock>
|
||||
<TextBlock Margin="0,0,16,0" IsVisible="{Binding HiddenTrack}">HIDDEN</TextBlock>
|
||||
<TextBlock Margin="0,0,16,0" Text="{Binding Volume}"/>
|
||||
<TextBlock Margin="0,0,16,0" Text="{Binding Volume, StringFormat='Volume {0}%'}"/>
|
||||
<TextBlock Margin="0,0,16,0" Text="{Binding CurrentDisc, StringFormat='Disc Number: {0}'}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ReactiveUserControl>
|
||||
Reference in New Issue
Block a user