mirror of
https://github.com/aaru-dps/RedBookPlayer.git
synced 2025-12-16 19:24:41 +00:00
Add currently-unused player update from UI
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -120,6 +121,7 @@ namespace RedBookPlayer.GUI
|
|||||||
private void InitializeComponent(string xaml)
|
private void InitializeComponent(string xaml)
|
||||||
{
|
{
|
||||||
DataContext = new PlayerViewModel();
|
DataContext = new PlayerViewModel();
|
||||||
|
(DataContext as PlayerViewModel).PropertyChanged += UpdateModel;
|
||||||
|
|
||||||
// Load the theme
|
// Load the theme
|
||||||
try
|
try
|
||||||
@@ -189,6 +191,17 @@ namespace RedBookPlayer.GUI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the Player with the most recent information from the UI
|
||||||
|
/// </summary>
|
||||||
|
private void UpdateModel(object sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
Player.UpdateModel(DataContext as PlayerViewModel);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the UI with the most recent information from the Player
|
/// Update the UI with the most recent information from the Player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -294,6 +294,19 @@ namespace RedBookPlayer.Hardware
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the internal values from the frontend
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataContext">Data context to update from</param>
|
||||||
|
public void UpdateModel(PlayerViewModel dataContext)
|
||||||
|
{
|
||||||
|
if(!Initialized || dataContext == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
App.Settings.Volume = dataContext.Volume;
|
||||||
|
ToggleDeEmphasis(dataContext.ApplyDeEmphasis);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get current sector time, accounting for offsets
|
/// Get current sector time, accounting for offsets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user