refactor(schedule): remove the end-now and start buttons from the now-playing card
The main start button already starts and ends the broadcast. With the buttons go ScheduleController.EndCurrentNow, its tests and texts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3dcc81cc43
commit
6c3396ab4d
7 files changed
+2
-103
No files matched your search
@@ -37,8 +37,8 @@ The interface is in German. This section names the controls as they appear on sc
|
|||||||
- The start field defaults to **Jetzt**. It also lists the next twelve full hours, and you can type your own time such as `14:30`. A typed time that has already passed today means tomorrow. A **Jetzt** plan begins with music up to the first news at the next :00 or :30; the chosen hours count from there.
|
- The start field defaults to **Jetzt**. It also lists the next twelve full hours, and you can type your own time such as `14:30`. A typed time that has already passed today means tomorrow. A **Jetzt** plan begins with music up to the first news at the next :00 or :30; the chosen hours count from there.
|
||||||
- **Jetzt starten** starts the plan you created. A **Jetzt** plan moves to the moment you press it, so nothing is skipped while you looked it over. It stays disabled until a plan exists. While laut.fm is switched on the button reads **Live starten** and also starts the live stream; if laut.fm cannot be reached, the music still plays and a warning says why. While on air the button turns red and reads **Sendung beenden**, which stops playback and the live stream together.
|
- **Jetzt starten** starts the plan you created. A **Jetzt** plan moves to the moment you press it, so nothing is skipped while you looked it over. It stays disabled until a plan exists. While laut.fm is switched on the button reads **Live starten** and also starts the live stream; if laut.fm cannot be reached, the music still plays and a warning says why. While on air the button turns red and reads **Sendung beenden**, which stops playback and the live stream together.
|
||||||
2. The timeline shows every item with start time, type (song, news, ad, moderator), title and duration.
|
2. The timeline shows every item with start time, type (song, news, ad, moderator), title and duration.
|
||||||
3. **Start** puts the plan on air on the real clock. Before the planned start the now-playing card shows when the broadcast begins; if the plan has already begun, playback joins at the next item. The same button then reads **Stopp** and ends it. The now-playing card shows the current item, its progress and the volume.
|
3. The now-playing card shows the current item and its progress. Before the planned start it shows when the broadcast begins; if the plan has already begun, playback joins at the next item.
|
||||||
4. **Edit the timeline**: select an upcoming row and use the buttons above the list to move it up or down, edit it, or remove it (trash icon), or drag it to a new place with the mouse: a label with type and title follows the cursor, a line shows where it lands, and the row fades in at its new place. The grip on the left of a row shows it can be dragged. **HinzufĂĽgen** inserts a song (the one chosen under **Songwunsch**), news, an ad or moderator talk as the item after next: two places after the item on air, or at position 3 of the list when nothing is on air; for everything but songs you set title and length first. News, ad and moderator items have no title until you give them one; news and moderator items can also change their length. A double-click opens the editor too. Every item after a change follows on without a gap. The item on air can be edited too, but not moved or removed; **Jetzt beenden** in the now-playing card ends it at once and starts the next item.
|
4. **Edit the timeline**: select an upcoming row and use the buttons above the list to move it up or down, edit it, or remove it (trash icon), or drag it to a new place with the mouse: a label with type and title follows the cursor, a line shows where it lands, and the row fades in at its new place. The grip on the left of a row shows it can be dragged. **HinzufĂĽgen** inserts a song (the one chosen under **Songwunsch**), news, an ad or moderator talk as the item after next: two places after the item on air, or at position 3 of the list when nothing is on air; for everything but songs you set title and length first. News, ad and moderator items have no title until you give them one; news and moderator items can also change their length. A double-click opens the editor too. Every item after a change follows on without a gap. The item on air can be edited too, but not moved or removed.
|
||||||
5. **Speaking reminder**: 30 seconds before a news or moderator item goes on air, a dialog in the middle of the screen reminds you on any page and stays until you click **OK**.
|
5. **Speaking reminder**: 30 seconds before a news or moderator item goes on air, a dialog in the middle of the screen reminds you on any page and stays until you click **OK**.
|
||||||
6. **Microphone**: **Mikro ein** in the now-playing card puts the default microphone on air, also over running music; the button turns red and reads **Mikro aus**. It works with or without a broadcast and stays on while you visit other pages.
|
6. **Microphone**: **Mikro ein** in the now-playing card puts the default microphone on air, also over running music; the button turns red and reads **Mikro aus**. It works with or without a broadcast and stays on while you visit other pages.
|
||||||
7. **Mix levels**, below the now-playing row: under **Was die Hörer hören**, **Musik** and **Mikrofon** set how loud the music and the microphone are for the listeners. Under **Was du hörst**, **Musik** sets how loud the music is on your own device; you never hear your own microphone there, because the delay is distracting. **Genau wie die Hörer** lets you hear exactly what the listeners hear, microphone included.
|
7. **Mix levels**, below the now-playing row: under **Was die Hörer hören**, **Musik** and **Mikrofon** set how loud the music and the microphone are for the listeners. Under **Was du hörst**, **Musik** sets how loud the music is on your own device; you never hear your own microphone there, because the delay is distracting. **Genau wie die Hörer** lets you hear exactly what the listeners hear, microphone included.
|
||||||
|
|||||||
@@ -190,22 +190,6 @@ public class ScheduleController
|
|||||||
/// <exception cref="ScheduleException">Item on air or over.</exception>
|
/// <exception cref="ScheduleException">Item on air or over.</exception>
|
||||||
public IReadOnlyList<ScheduleItem> Remove(int index) => Change(index, change: items => items.RemoveAt(index));
|
public IReadOnlyList<ScheduleItem> Remove(int index) => Change(index, change: items => items.RemoveAt(index));
|
||||||
|
|
||||||
/// <exception cref="ScheduleException">Nothing on air.</exception>
|
|
||||||
public IReadOnlyList<ScheduleItem> EndCurrentNow()
|
|
||||||
{
|
|
||||||
var index = CurrentIndex;
|
|
||||||
if (CurrentItem is null)
|
|
||||||
throw new ScheduleException(Loc.T("Schedule_NothingOnAirError"));
|
|
||||||
var now = _now();
|
|
||||||
// Whole seconds: next start not in the future.
|
|
||||||
var end = new DateTime(now.Ticks - now.Ticks % TimeSpan.TicksPerSecond, now.Kind);
|
|
||||||
return Change(index, currentAllowed: true, change: items =>
|
|
||||||
{
|
|
||||||
var item = items[index];
|
|
||||||
items[index] = item with { Duration = end > item.Start ? end - item.Start : TimeSpan.Zero };
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <exception cref="ScheduleException">Edit not allowed for item, or item over.</exception>
|
/// <exception cref="ScheduleException">Edit not allowed for item, or item over.</exception>
|
||||||
public IReadOnlyList<ScheduleItem> EditItem(int index, string title, TimeSpan duration) => Change(index, currentAllowed: true, change: items =>
|
public IReadOnlyList<ScheduleItem> EditItem(int index, string title, TimeSpan duration) => Change(index, currentAllowed: true, change: items =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -120,9 +120,6 @@
|
|||||||
<data name="Schedule_Empty" xml:space="preserve"><value>No schedule yet. Choose the hours and create a schedule.</value></data>
|
<data name="Schedule_Empty" xml:space="preserve"><value>No schedule yet. Choose the hours and create a schedule.</value></data>
|
||||||
<data name="Schedule_EndBroadcast" xml:space="preserve"><value>End broadcast</value></data>
|
<data name="Schedule_EndBroadcast" xml:space="preserve"><value>End broadcast</value></data>
|
||||||
<data name="Schedule_EndBroadcastFailed" xml:space="preserve"><value>The broadcast could not be ended</value></data>
|
<data name="Schedule_EndBroadcastFailed" xml:space="preserve"><value>The broadcast could not be ended</value></data>
|
||||||
<data name="Schedule_EndItemFailed" xml:space="preserve"><value>The item could not be ended</value></data>
|
|
||||||
<data name="Schedule_EndNow" xml:space="preserve"><value>End now</value></data>
|
|
||||||
<data name="Schedule_EndNowTip" xml:space="preserve"><value>Ends the current item right away; the next one starts.</value></data>
|
|
||||||
<data name="Schedule_ExtendFailed" xml:space="preserve"><value>The schedule could not be extended: {0}</value></data>
|
<data name="Schedule_ExtendFailed" xml:space="preserve"><value>The schedule could not be extended: {0}</value></data>
|
||||||
<data name="Schedule_Finished" xml:space="preserve"><value>Broadcast ended</value></data>
|
<data name="Schedule_Finished" xml:space="preserve"><value>Broadcast ended</value></data>
|
||||||
<data name="Schedule_FinishedText" xml:space="preserve"><value>The whole schedule has been played.</value></data>
|
<data name="Schedule_FinishedText" xml:space="preserve"><value>The whole schedule has been played.</value></data>
|
||||||
@@ -159,7 +156,6 @@
|
|||||||
<data name="Schedule_NoSong" xml:space="preserve"><value>No song selected</value></data>
|
<data name="Schedule_NoSong" xml:space="preserve"><value>No song selected</value></data>
|
||||||
<data name="Schedule_NoSongText" xml:space="preserve"><value>First choose a song under “Song request”.</value></data>
|
<data name="Schedule_NoSongText" xml:space="preserve"><value>First choose a song under “Song request”.</value></data>
|
||||||
<data name="Schedule_NothingOnAir" xml:space="preserve"><value>Nothing on air</value></data>
|
<data name="Schedule_NothingOnAir" xml:space="preserve"><value>Nothing on air</value></data>
|
||||||
<data name="Schedule_NothingOnAirError" xml:space="preserve"><value>Nothing is on air.</value></data>
|
|
||||||
<data name="Schedule_Now" xml:space="preserve"><value>Now</value></data>
|
<data name="Schedule_Now" xml:space="preserve"><value>Now</value></data>
|
||||||
<data name="Schedule_NowPlaying" xml:space="preserve"><value>On air now</value></data>
|
<data name="Schedule_NowPlaying" xml:space="preserve"><value>On air now</value></data>
|
||||||
<data name="Schedule_OnAirLocked" xml:space="preserve"><value>This item is on air. It can be edited or ended, but not moved or removed.</value></data>
|
<data name="Schedule_OnAirLocked" xml:space="preserve"><value>This item is on air. It can be edited or ended, but not moved or removed.</value></data>
|
||||||
@@ -186,7 +182,6 @@
|
|||||||
<data name="Schedule_StartTimeTip" xml:space="preserve"><value>“Now”, a full hour, or your own time like 14:30</value></data>
|
<data name="Schedule_StartTimeTip" xml:space="preserve"><value>“Now”, a full hour, or your own time like 14:30</value></data>
|
||||||
<data name="Schedule_StartUnclear" xml:space="preserve"><value>Choose “Now” or a time, or type one, for example 14:30.</value></data>
|
<data name="Schedule_StartUnclear" xml:space="preserve"><value>Choose “Now” or a time, or type one, for example 14:30.</value></data>
|
||||||
<data name="Schedule_StartUnclearTitle" xml:space="preserve"><value>Start time unclear</value></data>
|
<data name="Schedule_StartUnclearTitle" xml:space="preserve"><value>Start time unclear</value></data>
|
||||||
<data name="Schedule_Stop" xml:space="preserve"><value>Stop</value></data>
|
|
||||||
<data name="Schedule_StopLiveTip" xml:space="preserve"><value>Stops playback and the live stream to laut.fm.</value></data>
|
<data name="Schedule_StopLiveTip" xml:space="preserve"><value>Stops playback and the live stream to laut.fm.</value></data>
|
||||||
<data name="Schedule_StopTip" xml:space="preserve"><value>Stops playback.</value></data>
|
<data name="Schedule_StopTip" xml:space="preserve"><value>Stops playback.</value></data>
|
||||||
<data name="Schedule_Swap" xml:space="preserve"><value>Replace selection</value></data>
|
<data name="Schedule_Swap" xml:space="preserve"><value>Replace selection</value></data>
|
||||||
|
|||||||
@@ -120,9 +120,6 @@
|
|||||||
<data name="Schedule_Empty" xml:space="preserve"><value>Noch kein Plan. Stunden wählen und Plan erstellen.</value></data>
|
<data name="Schedule_Empty" xml:space="preserve"><value>Noch kein Plan. Stunden wählen und Plan erstellen.</value></data>
|
||||||
<data name="Schedule_EndBroadcast" xml:space="preserve"><value>Sendung beenden</value></data>
|
<data name="Schedule_EndBroadcast" xml:space="preserve"><value>Sendung beenden</value></data>
|
||||||
<data name="Schedule_EndBroadcastFailed" xml:space="preserve"><value>Die Sendung konnte nicht beendet werden</value></data>
|
<data name="Schedule_EndBroadcastFailed" xml:space="preserve"><value>Die Sendung konnte nicht beendet werden</value></data>
|
||||||
<data name="Schedule_EndItemFailed" xml:space="preserve"><value>Das Element konnte nicht beendet werden</value></data>
|
|
||||||
<data name="Schedule_EndNow" xml:space="preserve"><value>Jetzt beenden</value></data>
|
|
||||||
<data name="Schedule_EndNowTip" xml:space="preserve"><value>Beendet das laufende Element sofort; das nächste startet.</value></data>
|
|
||||||
<data name="Schedule_ExtendFailed" xml:space="preserve"><value>Der Plan konnte nicht verlängert werden: {0}</value></data>
|
<data name="Schedule_ExtendFailed" xml:space="preserve"><value>Der Plan konnte nicht verlängert werden: {0}</value></data>
|
||||||
<data name="Schedule_Finished" xml:space="preserve"><value>Sendung beendet</value></data>
|
<data name="Schedule_Finished" xml:space="preserve"><value>Sendung beendet</value></data>
|
||||||
<data name="Schedule_FinishedText" xml:space="preserve"><value>Der ganze Plan wurde gespielt.</value></data>
|
<data name="Schedule_FinishedText" xml:space="preserve"><value>Der ganze Plan wurde gespielt.</value></data>
|
||||||
@@ -159,7 +156,6 @@
|
|||||||
<data name="Schedule_NoSong" xml:space="preserve"><value>Kein Song gewählt</value></data>
|
<data name="Schedule_NoSong" xml:space="preserve"><value>Kein Song gewählt</value></data>
|
||||||
<data name="Schedule_NoSongText" xml:space="preserve"><value>Wähle zuerst unter „Songwunsch“ einen Song.</value></data>
|
<data name="Schedule_NoSongText" xml:space="preserve"><value>Wähle zuerst unter „Songwunsch“ einen Song.</value></data>
|
||||||
<data name="Schedule_NothingOnAir" xml:space="preserve"><value>Nichts auf Sendung</value></data>
|
<data name="Schedule_NothingOnAir" xml:space="preserve"><value>Nichts auf Sendung</value></data>
|
||||||
<data name="Schedule_NothingOnAirError" xml:space="preserve"><value>Es ist nichts auf Sendung.</value></data>
|
|
||||||
<data name="Schedule_Now" xml:space="preserve"><value>Jetzt</value></data>
|
<data name="Schedule_Now" xml:space="preserve"><value>Jetzt</value></data>
|
||||||
<data name="Schedule_NowPlaying" xml:space="preserve"><value>Läuft gerade</value></data>
|
<data name="Schedule_NowPlaying" xml:space="preserve"><value>Läuft gerade</value></data>
|
||||||
<data name="Schedule_OnAirLocked" xml:space="preserve"><value>Dieses Element ist auf Sendung. Es kann bearbeitet oder beendet, aber nicht verschoben oder entfernt werden.</value></data>
|
<data name="Schedule_OnAirLocked" xml:space="preserve"><value>Dieses Element ist auf Sendung. Es kann bearbeitet oder beendet, aber nicht verschoben oder entfernt werden.</value></data>
|
||||||
@@ -186,7 +182,6 @@
|
|||||||
<data name="Schedule_StartTimeTip" xml:space="preserve"><value>„Jetzt“, eine volle Stunde oder eine eigene Uhrzeit wie 14:30</value></data>
|
<data name="Schedule_StartTimeTip" xml:space="preserve"><value>„Jetzt“, eine volle Stunde oder eine eigene Uhrzeit wie 14:30</value></data>
|
||||||
<data name="Schedule_StartUnclear" xml:space="preserve"><value>Wähle „Jetzt“ oder eine Uhrzeit, oder tippe eine ein, zum Beispiel 14:30.</value></data>
|
<data name="Schedule_StartUnclear" xml:space="preserve"><value>Wähle „Jetzt“ oder eine Uhrzeit, oder tippe eine ein, zum Beispiel 14:30.</value></data>
|
||||||
<data name="Schedule_StartUnclearTitle" xml:space="preserve"><value>Startzeit unklar</value></data>
|
<data name="Schedule_StartUnclearTitle" xml:space="preserve"><value>Startzeit unklar</value></data>
|
||||||
<data name="Schedule_Stop" xml:space="preserve"><value>Stopp</value></data>
|
|
||||||
<data name="Schedule_StopLiveTip" xml:space="preserve"><value>Stoppt die Wiedergabe und den Livestream zu laut.fm.</value></data>
|
<data name="Schedule_StopLiveTip" xml:space="preserve"><value>Stoppt die Wiedergabe und den Livestream zu laut.fm.</value></data>
|
||||||
<data name="Schedule_StopTip" xml:space="preserve"><value>Stoppt die Wiedergabe.</value></data>
|
<data name="Schedule_StopTip" xml:space="preserve"><value>Stoppt die Wiedergabe.</value></data>
|
||||||
<data name="Schedule_Swap" xml:space="preserve"><value>Auswahl ersetzen</value></data>
|
<data name="Schedule_Swap" xml:space="preserve"><value>Auswahl ersetzen</value></data>
|
||||||
|
|||||||
@@ -134,25 +134,10 @@
|
|||||||
<!-- Live microphone on the program channel; label and icon say whether it is on. -->
|
<!-- Live microphone on the program channel; label and icon say whether it is on. -->
|
||||||
<ui:Button x:Name="MicButton"
|
<ui:Button x:Name="MicButton"
|
||||||
MinWidth="120"
|
MinWidth="120"
|
||||||
Margin="0,0,20,0"
|
|
||||||
Content="{l:Tr Schedule_MicOn}"
|
Content="{l:Tr Schedule_MicOn}"
|
||||||
Icon="{ui:SymbolIcon Mic24}"
|
Icon="{ui:SymbolIcon Mic24}"
|
||||||
ToolTip="{l:Tr Schedule_MicTip}"
|
ToolTip="{l:Tr Schedule_MicTip}"
|
||||||
Click="OnMicToggle" />
|
Click="OnMicToggle" />
|
||||||
<ui:Button x:Name="EndNowButton"
|
|
||||||
Content="{l:Tr Schedule_EndNow}"
|
|
||||||
Icon="{ui:SymbolIcon Next24}"
|
|
||||||
ToolTip="{l:Tr Schedule_EndNowTip}"
|
|
||||||
IsEnabled="False"
|
|
||||||
Click="OnEndNow" />
|
|
||||||
<!-- One button: Start while idle, Stop while on air. -->
|
|
||||||
<ui:Button x:Name="PlayButton"
|
|
||||||
MinWidth="110"
|
|
||||||
Margin="8,0,0,0"
|
|
||||||
Content="{l:Tr Schedule_Start}"
|
|
||||||
Icon="{ui:SymbolIcon Play24}"
|
|
||||||
IsEnabled="False"
|
|
||||||
Click="OnPlayToggle" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ public partial class SchedulePage : Page
|
|||||||
private readonly DispatcherTimer _progressTimer = new() { Interval = TimeSpan.FromMilliseconds(250) };
|
private readonly DispatcherTimer _progressTimer = new() { Interval = TimeSpan.FromMilliseconds(250) };
|
||||||
private bool _loading;
|
private bool _loading;
|
||||||
private int _scrolledTo = -1;
|
private int _scrolledTo = -1;
|
||||||
private bool? _shownPlaying;
|
|
||||||
private (bool OnAir, bool Live, bool Enabled)? _shownStart;
|
private (bool OnAir, bool Live, bool Enabled)? _shownStart;
|
||||||
|
|
||||||
private readonly ObservableCollection<TimelineRow> _rows = [];
|
private readonly ObservableCollection<TimelineRow> _rows = [];
|
||||||
@@ -96,7 +95,6 @@ public partial class SchedulePage : Page
|
|||||||
private void OnLanguageChanged(object? sender, EventArgs e) => Dispatcher.BeginInvoke(() =>
|
private void OnLanguageChanged(object? sender, EventArgs e) => Dispatcher.BeginInvoke(() =>
|
||||||
{
|
{
|
||||||
_shownStart = null;
|
_shownStart = null;
|
||||||
_shownPlaying = null;
|
|
||||||
var selected = Timeline.SelectedIndex;
|
var selected = Timeline.SelectedIndex;
|
||||||
_rows.Clear();
|
_rows.Clear();
|
||||||
NowKind.Content = null; // same item again would not refresh the chip
|
NowKind.Content = null; // same item again would not refresh the chip
|
||||||
@@ -313,20 +311,6 @@ public partial class SchedulePage : Page
|
|||||||
System.Windows.Automation.AutomationProperties.SetName(StartNowButton, (string)StartNowButton.Content);
|
System.Windows.Automation.AutomationProperties.SetName(StartNowButton, (string)StartNowButton.Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEndNow(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_controller.EndCurrentNow();
|
|
||||||
Message.IsOpen = false;
|
|
||||||
}
|
|
||||||
catch (ScheduleException ex)
|
|
||||||
{
|
|
||||||
ShowMessage(InfoBarSeverity.Error, Loc.T("Schedule_EndItemFailed"), ex.Message);
|
|
||||||
}
|
|
||||||
ShowCurrent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnRemove(object sender, RoutedEventArgs e) => ChangeSelected(row => _controller.Remove(row.Index));
|
private void OnRemove(object sender, RoutedEventArgs e) => ChangeSelected(row => _controller.Remove(row.Index));
|
||||||
|
|
||||||
private void OnAddItem(object sender, RoutedEventArgs e)
|
private void OnAddItem(object sender, RoutedEventArgs e)
|
||||||
@@ -549,16 +533,6 @@ public partial class SchedulePage : Page
|
|||||||
|
|
||||||
private void OnTimelineSelectionChanged(object sender, SelectionChangedEventArgs e) => UpdateButtons();
|
private void OnTimelineSelectionChanged(object sender, SelectionChangedEventArgs e) => UpdateButtons();
|
||||||
|
|
||||||
private async void OnPlayToggle(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var stop = _controller.IsPlaying;
|
|
||||||
_expectPlaying = !stop;
|
|
||||||
if (stop)
|
|
||||||
NowKind.Visibility = Visibility.Collapsed;
|
|
||||||
UpdateProgress();
|
|
||||||
await RunAsync(Loc.T("Schedule_StartFailed"), stop ? _controller.Stop : _controller.Start);
|
|
||||||
}
|
|
||||||
|
|
||||||
// BeginInvoke, not Invoke: engine Stop waits for this pool thread -> deadlock.
|
// BeginInvoke, not Invoke: engine Stop waits for this pool thread -> deadlock.
|
||||||
private void OnItemStarted(object? sender, int index) => Dispatcher.BeginInvoke(ShowCurrent);
|
private void OnItemStarted(object? sender, int index) => Dispatcher.BeginInvoke(ShowCurrent);
|
||||||
|
|
||||||
@@ -609,17 +583,10 @@ public partial class SchedulePage : Page
|
|||||||
private void UpdateButtons()
|
private void UpdateButtons()
|
||||||
{
|
{
|
||||||
var playing = _expectPlaying ?? _controller.IsPlaying;
|
var playing = _expectPlaying ?? _controller.IsPlaying;
|
||||||
PlayButton.IsEnabled = !_working && (playing || _controller.Plan.Count > 0);
|
|
||||||
CreateButton.IsEnabled = !_working;
|
CreateButton.IsEnabled = !_working;
|
||||||
// Without a plan only stopping makes sense.
|
// Without a plan only stopping makes sense.
|
||||||
StartNowButton.IsEnabled = !_working && (OnAir || _controller.Plan.Count > 0);
|
StartNowButton.IsEnabled = !_working && (OnAir || _controller.Plan.Count > 0);
|
||||||
ShowStartButton();
|
ShowStartButton();
|
||||||
if (playing != _shownPlaying)
|
|
||||||
{
|
|
||||||
_shownPlaying = playing;
|
|
||||||
PlayButton.Content = Loc.T(playing ? "Schedule_Stop" : "Schedule_Start");
|
|
||||||
PlayButton.Icon = new SymbolIcon(playing ? SymbolRegular.Stop24 : SymbolRegular.Play24);
|
|
||||||
}
|
|
||||||
|
|
||||||
var row = Timeline.SelectedItem as TimelineRow;
|
var row = Timeline.SelectedItem as TimelineRow;
|
||||||
|
|
||||||
@@ -633,7 +600,6 @@ public partial class SchedulePage : Page
|
|||||||
RemoveButton.IsEnabled = Editable(index);
|
RemoveButton.IsEnabled = Editable(index);
|
||||||
var onAir = !_working && playing && index >= 0 && index == current;
|
var onAir = !_working && playing && index >= 0 && index == current;
|
||||||
EditItemButton.IsEnabled = (Editable(index) || onAir) && row!.Item.Kind != ScheduleItemKind.Song;
|
EditItemButton.IsEnabled = (Editable(index) || onAir) && row!.Item.Kind != ScheduleItemKind.Song;
|
||||||
EndNowButton.IsEnabled = !_working && _expectPlaying != false && _controller.CurrentItem is not null;
|
|
||||||
|
|
||||||
var blocker = row switch
|
var blocker = row switch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -265,32 +265,6 @@ public sealed class ScheduleControllerTests : IDisposable
|
|||||||
return (controller, started);
|
return (controller, started);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task EndCurrentNow_EndsTheItemOnAirAndStartsTheNext()
|
|
||||||
{
|
|
||||||
var (controller, started) = await OnAirWithTheFirstNewsAsync();
|
|
||||||
_now = _now.AddMinutes(2);
|
|
||||||
|
|
||||||
var plan = controller.EndCurrentNow();
|
|
||||||
|
|
||||||
Assert.Equal(TimeSpan.FromMinutes(2), plan[0].Duration);
|
|
||||||
AssertContiguousFrom(plan, plan[0].Start);
|
|
||||||
Assert.Equal(_now, plan[1].Start);
|
|
||||||
Assert.True(await started.WaitAsync(TimeSpan.FromSeconds(5)));
|
|
||||||
Assert.Equal(1, controller.CurrentIndex);
|
|
||||||
controller.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void EndCurrentNow_WithNothingOnAirThrows()
|
|
||||||
{
|
|
||||||
AddSongs();
|
|
||||||
var controller = Create();
|
|
||||||
controller.CreatePlan(1);
|
|
||||||
|
|
||||||
Assert.Throws<ScheduleException>(() => controller.EndCurrentNow());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task EditItem_ChangesTheItemOnAirButItCannotBeRemoved()
|
public async Task EditItem_ChangesTheItemOnAirButItCannotBeRemoved()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user