refactor: build services with dependency injection
App registers the services, controllers, the main window and the pages in a container, and the navigation view asks it for each page. Pages get their controllers through the constructor instead of reading statics from App. SettingsStore takes over the current settings from App. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
65743279b1
commit
c6e9bf4e82
9 files changed
+112
-35
No files matched your search
@@ -11,7 +11,7 @@ namespace Radiosender.Views.Pages;
|
||||
|
||||
public partial class SchedulePage : Page
|
||||
{
|
||||
private readonly ScheduleController _controller = App.Schedule;
|
||||
private readonly ScheduleController _controller;
|
||||
private readonly DispatcherTimer _progressTimer = new() { Interval = TimeSpan.FromMilliseconds(250) };
|
||||
private bool _loading;
|
||||
private int _scrolledTo = -1;
|
||||
@@ -29,8 +29,9 @@ public partial class SchedulePage : Page
|
||||
// Optimistic state: what the user just asked for, shown before the engine has caught up.
|
||||
private bool? _expectPlaying;
|
||||
|
||||
public SchedulePage()
|
||||
public SchedulePage(ScheduleController controller)
|
||||
{
|
||||
_controller = controller;
|
||||
InitializeComponent();
|
||||
Timeline.ItemsSource = _rows;
|
||||
// Also refreshes the buttons: Finished can arrive just before the engine reports it stopped.
|
||||
|
||||
Reference in new issue
Block a user