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:
@@ -16,6 +16,8 @@
|
||||
| **Space** | Toggle Play / Pause |
|
||||
| **Esc** | Stop Playback |
|
||||
| **~** | Eject |
|
||||
| **Page Up** | Next Disc |
|
||||
| **Page Down** | Previous Disc |
|
||||
| **→** | Next Track |
|
||||
| **←** | Previous Track |
|
||||
| **]** | Next Index |
|
||||
|
||||
@@ -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>
|
||||
@@ -299,13 +299,14 @@ namespace RedBookPlayer.Models.Discs
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Init(IOpticalMediaImage image, bool autoPlay)
|
||||
public override void Init(string path, IOpticalMediaImage image, bool autoPlay)
|
||||
{
|
||||
// If the image is null, we can't do anything
|
||||
if(image == null)
|
||||
return;
|
||||
|
||||
// Set the current disc image
|
||||
ImagePath = path;
|
||||
_image = image;
|
||||
|
||||
// Attempt to load the TOC
|
||||
|
||||
@@ -8,6 +8,11 @@ namespace RedBookPlayer.Models.Discs
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Path to the disc image
|
||||
/// </summary>
|
||||
public string ImagePath { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicate if the disc is ready to be used
|
||||
/// </summary>
|
||||
@@ -93,9 +98,10 @@ namespace RedBookPlayer.Models.Discs
|
||||
/// <summary>
|
||||
/// Initialize the disc with a given image
|
||||
/// </summary>
|
||||
/// <param name="path">Path of the image</param>
|
||||
/// <param name="image">Aaruformat image to load</param>
|
||||
/// <param name="autoPlay">True if playback should begin immediately, false otherwise</param>
|
||||
public abstract void Init(IOpticalMediaImage image, bool autoPlay);
|
||||
public abstract void Init(string path, IOpticalMediaImage image, bool autoPlay);
|
||||
|
||||
#region Seeking
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace RedBookPlayer.Models.Factories
|
||||
image.Open(filter);
|
||||
|
||||
// Generate and instantiate the disc
|
||||
return GenerateFromImage(image, options, autoPlay);
|
||||
return GenerateFromImage(path, image, options, autoPlay);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -44,11 +44,12 @@ namespace RedBookPlayer.Models.Factories
|
||||
/// <summary>
|
||||
/// Generate an OpticalDisc from an input IOpticalMediaImage
|
||||
/// </summary>
|
||||
/// <param name="path">Path of the image</param>
|
||||
/// <param name="image">IOpticalMediaImage to create from</param>
|
||||
/// <param name="options">Options to pass to the optical disc factory</param>
|
||||
/// <param name="autoPlay">True if the image should be playable immediately, false otherwise</param>
|
||||
/// <returns>Instantiated OpticalDisc, if possible</returns>
|
||||
public static OpticalDiscBase GenerateFromImage(IOpticalMediaImage image, OpticalDiscOptions options, bool autoPlay)
|
||||
public static OpticalDiscBase GenerateFromImage(string path, IOpticalMediaImage image, OpticalDiscOptions options, bool autoPlay)
|
||||
{
|
||||
// If the image is not usable, we don't do anything
|
||||
if(!IsUsableImage(image))
|
||||
@@ -74,7 +75,7 @@ namespace RedBookPlayer.Models.Factories
|
||||
return opticalDisc;
|
||||
|
||||
// Instantiate the disc and return
|
||||
opticalDisc.Init(image, autoPlay);
|
||||
opticalDisc.Init(path, image, autoPlay);
|
||||
return opticalDisc;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,15 @@ namespace RedBookPlayer.Models.Hardware
|
||||
|
||||
#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>
|
||||
@@ -156,6 +165,7 @@ namespace RedBookPlayer.Models.Hardware
|
||||
/// </summary>
|
||||
public ulong TotalTime => _opticalDiscs[CurrentDisc]?.TotalTime ?? 0;
|
||||
|
||||
private string _imagePath;
|
||||
private int _currentTrackNumber;
|
||||
private ushort _currentTrackIndex;
|
||||
private ushort _currentTrackSession;
|
||||
@@ -669,6 +679,7 @@ namespace RedBookPlayer.Models.Hardware
|
||||
/// </summary>
|
||||
private void OpticalDiscStateChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
ImagePath = _opticalDiscs[CurrentDisc].ImagePath;
|
||||
CurrentTrackNumber = _opticalDiscs[CurrentDisc].CurrentTrackNumber;
|
||||
CurrentTrackIndex = _opticalDiscs[CurrentDisc].CurrentTrackIndex;
|
||||
CurrentSector = _opticalDiscs[CurrentDisc].CurrentSector;
|
||||
|
||||
Reference in New Issue
Block a user