mirror of
https://github.com/aaru-dps/RedBookPlayer.git
synced 2025-12-16 19:24:41 +00:00
Make view-model stop playback
This commit is contained in:
@@ -64,9 +64,6 @@ namespace RedBookPlayer.GUI
|
|||||||
/// <param name="path">Path to the image to load</param>
|
/// <param name="path">Path to the image to load</param>
|
||||||
public async Task<bool> LoadImage(string path)
|
public async Task<bool> LoadImage(string path)
|
||||||
{
|
{
|
||||||
// If the player is currently running, stop it
|
|
||||||
if(PlayerViewModel.Playing != true) PlayerViewModel.Playing = null;
|
|
||||||
|
|
||||||
bool result = await Dispatcher.UIThread.InvokeAsync(() =>
|
bool result = await Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
PlayerViewModel.Init(path, App.Settings.AutoPlay, App.Settings.Volume);
|
PlayerViewModel.Init(path, App.Settings.AutoPlay, App.Settings.Volume);
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ namespace RedBookPlayer.GUI
|
|||||||
/// <param name="defaultVolume">Default volume between 0 and 100 to use when starting playback</param>
|
/// <param name="defaultVolume">Default volume between 0 and 100 to use when starting playback</param>
|
||||||
public void Init(string path, bool autoPlay, int defaultVolume)
|
public void Init(string path, bool autoPlay, int defaultVolume)
|
||||||
{
|
{
|
||||||
|
// Stop current playback, if necessary
|
||||||
|
if(Playing != null) Playing = null;
|
||||||
|
|
||||||
|
// Create and attempt to initialize new Player
|
||||||
_player = new Player(path, autoPlay, defaultVolume);
|
_player = new Player(path, autoPlay, defaultVolume);
|
||||||
if(Initialized)
|
if(Initialized)
|
||||||
UpdateModel();
|
UpdateModel();
|
||||||
|
|||||||
Reference in New Issue
Block a user