MetaChanged throttle 2s - verhindert UI-Flooding durch DVB-Metadaten
This commit is contained in:
parent
58ffc7300b
commit
27b5b6805f
1 changed files with 6 additions and 1 deletions
|
|
@ -531,8 +531,14 @@ public partial class MainWindow : Window
|
||||||
RadioFallbackIcon.Visibility = Visibility.Visible;
|
RadioFallbackIcon.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DateTime _lastMetaUpdate = DateTime.MinValue;
|
||||||
|
|
||||||
private void OnMediaMetaChanged(object? sender, MediaMetaChangedEventArgs args)
|
private void OnMediaMetaChanged(object? sender, MediaMetaChangedEventArgs args)
|
||||||
{
|
{
|
||||||
|
// Throttle: maximal alle 2s verarbeiten damit der UI-Thread nicht geflutet wird
|
||||||
|
var now = DateTime.Now;
|
||||||
|
if ((now - _lastMetaUpdate).TotalSeconds < 2) return;
|
||||||
|
_lastMetaUpdate = now;
|
||||||
if (sender is Media m) Dispatcher.BeginInvoke(() => UpdateEpgFromMedia(m));
|
if (sender is Media m) Dispatcher.BeginInvoke(() => UpdateEpgFromMedia(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1084,7 +1090,6 @@ public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
if (msg == WM_KEYDOWN && (int)wParam == VK_B)
|
if (msg == WM_KEYDOWN && (int)wParam == VK_B)
|
||||||
{
|
{
|
||||||
// GetKeyState(VK_CONTROL) - High-bit gesetzt = Taste gedrueckt
|
|
||||||
var ctrl = (NativeMethods.GetKeyState(0x11) & 0x8000) != 0;
|
var ctrl = (NativeMethods.GetKeyState(0x11) & 0x8000) != 0;
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
Dispatcher.BeginInvoke(() => BtnSidebarToggle_Click(this, new RoutedEventArgs()));
|
Dispatcher.BeginInvoke(() => BtnSidebarToggle_Click(this, new RoutedEventArgs()));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue