EPG: Scroll-Position nach Erinnerung-Rebuild beibehalten
This commit is contained in:
parent
951e02f0fb
commit
dbd7aad30d
1 changed files with 18 additions and 6 deletions
|
|
@ -823,6 +823,8 @@ public partial class MainWindow : Window
|
|||
private const int EpgTotalHours = 8;
|
||||
|
||||
private DateTime _epgStartTime;
|
||||
private double _epgScrollH = 0;
|
||||
private double _epgScrollV = 0;
|
||||
|
||||
private async Task ShowEpgOverlayAsync()
|
||||
{
|
||||
|
|
@ -844,7 +846,7 @@ public partial class MainWindow : Window
|
|||
}
|
||||
|
||||
TxtEpgOverlayStatus.Text = "Baue Programm\u2026";
|
||||
await BuildEpgGridAsync();
|
||||
await BuildEpgGridAsync(resetScroll: true);
|
||||
}
|
||||
|
||||
private void HideEpgOverlay()
|
||||
|
|
@ -853,9 +855,11 @@ public partial class MainWindow : Window
|
|||
EpgCanvas.Children.Clear();
|
||||
}
|
||||
|
||||
private async Task BuildEpgGridAsync()
|
||||
|
||||
private async Task BuildEpgGridAsync(bool resetScroll = false)
|
||||
{
|
||||
// Erst nach Background-Priority clearen damit laufende Event-Handler fertig sind
|
||||
_epgScrollH = EpgScrollViewer.HorizontalOffset;
|
||||
_epgScrollV = EpgScrollViewer.VerticalOffset;
|
||||
await Dispatcher.InvokeAsync(() => EpgCanvas.Children.Clear(),
|
||||
System.Windows.Threading.DispatcherPriority.Background);
|
||||
EpgCanvas.Children.Clear();
|
||||
|
|
@ -887,8 +891,16 @@ public partial class MainWindow : Window
|
|||
}
|
||||
|
||||
TxtEpgOverlayStatus.Text = $"{channels.Count} Sender \u00b7 {EpgTotalHours} Stunden";
|
||||
EpgScrollViewer.ScrollToHorizontalOffset(0);
|
||||
EpgScrollViewer.ScrollToVerticalOffset(0);
|
||||
if (resetScroll)
|
||||
{
|
||||
EpgScrollViewer.ScrollToHorizontalOffset(0);
|
||||
EpgScrollViewer.ScrollToVerticalOffset(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
EpgScrollViewer.ScrollToHorizontalOffset(_epgScrollH);
|
||||
EpgScrollViewer.ScrollToVerticalOffset(_epgScrollV);
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildEpgHeader(double totalMinutes, double contentWidth, double contentHeight)
|
||||
|
|
@ -1104,7 +1116,7 @@ public partial class MainWindow : Window
|
|||
});
|
||||
}
|
||||
// Verzoegert neu bauen damit Event-Handler sauber abgeschlossen ist
|
||||
Dispatcher.BeginInvoke(async () => await BuildEpgGridAsync(),
|
||||
Dispatcher.BeginInvoke(async () => await BuildEpgGridAsync(resetScroll: false),
|
||||
System.Windows.Threading.DispatcherPriority.Background);
|
||||
};
|
||||
menu.Items.Add(remind);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue