Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/LageBuch.App/Services/SerialAudioQueue.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;

namespace LageBuch.App.Services;

Expand All @@ -11,7 +12,9 @@ namespace LageBuch.App.Services;
/// audio player process that never exits), the queue moves on to the next item anyway so one
/// stuck cue can't permanently silence later ones.
/// </summary>
public sealed class SerialAudioQueue
[SuppressMessage("Design", "CA1001",
Justification = "App-lifetime singleton: its worker thread drains until process shutdown, so the owning BlockingCollection is intentionally never disposed.")]
internal sealed class SerialAudioQueue
{
private readonly BlockingCollection<Action> _queue = new();
private readonly TimeSpan _perItemTimeout;
Expand All @@ -26,6 +29,8 @@ public SerialAudioQueue(TimeSpan? perItemTimeout = null)
/// <summary>Queues <paramref name="play"/> to run after everything already queued.</summary>
public void Enqueue(Action play) => _queue.Add(play);

[SuppressMessage("Design", "CA1031",
Justification = "A misbehaving or hanging cue must not stop the worker from serving the next one (the per-item timeout has already elapsed).")]
private void Run()
{
foreach (var play in _queue.GetConsumingEnumerable())
Expand Down
2 changes: 2 additions & 0 deletions src/LageBuch.App/Services/SystemAlarmService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public void Play(AlarmSound sound)
}

// Runs on the SerialAudioQueue's worker thread; blocks until the clip finishes playing.
[SuppressMessage("Design", "CA1031",
Justification = "Player binary missing (e.g. a headless Linux host without ALSA) — stay silent.")]
private void PlayBlocking(AlarmSound sound, byte[] bytes)
{
if (OperatingSystem.IsWindows())
Expand Down
6 changes: 4 additions & 2 deletions src/LageBuch.Documents/Sections/AtemschutzSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace LageBuch.Documents.Sections;

public static class AtemschutzSection
{
private static readonly string[] HeaderTitles =
["Trupp", "Mannschaft", "Funkrufname", "Start", "Rückzug", "Ende", "Druck Start", "Druck akt."];

public static void Compose(IContainer container, Incident incident)
{
container.Column(column =>
Expand Down Expand Up @@ -36,8 +39,7 @@ public static void Compose(IContainer container, Incident incident)

table.Header(header =>
{
foreach (var title in new[]
{ "Trupp", "Mannschaft", "Funkrufname", "Start", "Rückzug", "Ende", "Druck Start", "Druck akt." })
foreach (var title in HeaderTitles)
header.Cell().Element(Cells.Header).Text(title).SemiBold();
});

Expand Down
3 changes: 2 additions & 1 deletion src/LageBuch.Documents/Sections/EtbSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace LageBuch.Documents.Sections;

public static class EtbSection
{
private static readonly string[] HeaderTitles = ["Zeit", "Richtung", "Von", "An", "Eintrag", "Erfasst von"];
public static void Compose(IContainer container, Incident incident)
{
container.Column(column =>
Expand Down Expand Up @@ -34,7 +35,7 @@ public static void Compose(IContainer container, Incident incident)

table.Header(header =>
{
foreach (var title in new[] { "Zeit", "Richtung", "Von", "An", "Eintrag", "Erfasst von" })
foreach (var title in HeaderTitles)
header.Cell().Element(HeaderCell).Text(title).SemiBold();
});

Expand Down
3 changes: 2 additions & 1 deletion src/LageBuch.Documents/Sections/FilesSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace LageBuch.Documents.Sections;
/// </summary>
public static class FilesSection
{
private static readonly string[] HeaderTitles = ["Name", "Hinzugefügt von", "Datum"];
public static void Compose(IContainer container, IReadOnlyList<IncidentFile> files, IReadOnlyDictionary<Guid, byte[]> imageBytesById)
{
container.Column(column =>
Expand All @@ -37,7 +38,7 @@ public static void Compose(IContainer container, IReadOnlyList<IncidentFile> fil

table.Header(header =>
{
foreach (var title in new[] { "Name", "Hinzugefügt von", "Datum" })
foreach (var title in HeaderTitles)
header.Cell().Element(Cells.Header).Text(title).SemiBold();
});

Expand Down
3 changes: 2 additions & 1 deletion src/LageBuch.Documents/Sections/ForcesSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace LageBuch.Documents.Sections;

public static class ForcesSection
{
private static readonly string[] HeaderTitles = ["Feuerwehr", "Funkrufname", "Stärke", "AGT", "Status", "Bemerkung"];
public static void Compose(IContainer container, Incident incident)
{
container.Column(column =>
Expand All @@ -31,7 +32,7 @@ public static void Compose(IContainer container, Incident incident)

table.Header(header =>
{
foreach (var title in new[] { "Feuerwehr", "Funkrufname", "Stärke", "AGT", "Status", "Bemerkung" })
foreach (var title in HeaderTitles)
header.Cell().Element(Cells.Header).Text(title).SemiBold();
});

Expand Down
3 changes: 2 additions & 1 deletion src/LageBuch.Documents/Sections/RolesSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace LageBuch.Documents.Sections;

public static class RolesSection
{
private static readonly string[] HeaderTitles = ["Funktion", "Name", "Abschnitt", "Funkrufname", "Handynummer", "Von", "Bis"];
public static void Compose(IContainer container, Incident incident)
{
container.Column(column =>
Expand Down Expand Up @@ -37,7 +38,7 @@ public static void Compose(IContainer container, Incident incident)

table.Header(header =>
{
foreach (var title in new[] { "Funktion", "Name", "Abschnitt", "Funkrufname", "Handynummer", "Von", "Bis" })
foreach (var title in HeaderTitles)
header.Cell().Element(Cells.Header).Text(title).SemiBold();
});

Expand Down
3 changes: 2 additions & 1 deletion src/LageBuch.Documents/Sections/TasksSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace LageBuch.Documents.Sections;

public static class TasksSection
{
private static readonly string[] HeaderTitles = ["", "Wichtig", "Dringlich", "Fällig", "Zugeteilt", "Aufgabe", "Erledigt"];
public static void Compose(IContainer container, Incident incident)
{
container.Column(column =>
Expand Down Expand Up @@ -41,7 +42,7 @@ public static void Compose(IContainer container, Incident incident)

table.Header(header =>
{
foreach (var title in new[] { "", "Wichtig", "Dringlich", "Fällig", "Zugeteilt", "Aufgabe", "Erledigt" })
foreach (var title in HeaderTitles)
header.Cell().Element(HeaderCell).Text(title).SemiBold();
});

Expand Down
3 changes: 3 additions & 0 deletions tests/LageBuch.Acceptance.Tests/WorkspaceAcceptanceTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
Expand Down Expand Up @@ -68,7 +69,9 @@ private sealed class Sub : IDisposable { public void Dispose() { } }
}
internal sealed class NoopAlarmService : IAlarmService
{
[SuppressMessage("Performance", "CA1822", Justification = "Implements IAlarmService; interface members cannot be static.")]
public void Start() { }
[SuppressMessage("Performance", "CA1822", Justification = "Implements IAlarmService; interface members cannot be static.")]
public void Stop() { }
public void Play(AlarmSound sound) { }
}
Expand Down
3 changes: 3 additions & 0 deletions tests/LageBuch.Sync.Hosting.Tests/TestDoubles.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Sockets;
using LageBuch.AppLogic;
Expand Down Expand Up @@ -34,7 +35,9 @@ private sealed class Sub : IDisposable { public void Dispose() { } }

internal sealed class NoAlarm : IAlarmService
{
[SuppressMessage("Performance", "CA1822", Justification = "Implements IAlarmService; interface members cannot be static.")]
public void Start() { }
[SuppressMessage("Performance", "CA1822", Justification = "Implements IAlarmService; interface members cannot be static.")]
public void Stop() { }
public void Play(AlarmSound sound) { }
}
Expand Down
Loading