Skip to content

Commit 90c61a2

Browse files
feat: add event for when OpenRGB started changes
1 parent 8227e46 commit 90c61a2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/ChromaControl.SDK.OpenRGB/IOpenRGBService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public interface IOpenRGBService
1919
/// </summary>
2020
bool Started { get; }
2121

22+
/// <summary>
23+
/// Occurs when <see cref="Started"/> changes.
24+
/// </summary>
25+
event EventHandler<bool>? StartedChanged;
26+
2227
/// <summary>
2328
/// The devices available in OpenRGB.
2429
/// </summary>

src/ChromaControl.SDK.OpenRGB/OpenRGBService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class OpenRGBService : IOpenRGBService, IAsyncDisposable
2121
/// <inheritdoc/>
2222
public bool Started { get; internal set; }
2323

24+
/// <inheritdoc/>
25+
public event EventHandler<bool>? StartedChanged;
26+
2427
/// <inheritdoc/>
2528
public ImmutableList<OpenRGBDevice> Devices => [.. _devices];
2629

@@ -51,6 +54,7 @@ public async Task Restart(CancellationToken cancellationToken = default)
5154
if (Started)
5255
{
5356
Started = false;
57+
StartedChanged?.Invoke(this, Started);
5458

5559
_service.DeviceListUpdated -= OnDeviceListUpdated;
5660
await _service.DisposeAsync();
@@ -242,5 +246,6 @@ private async void OnDeviceListUpdated(object? sender, EventArgs e)
242246
await UpdateDeviceListAsync();
243247

244248
Started = true;
249+
StartedChanged?.Invoke(this, Started);
245250
}
246251
}

0 commit comments

Comments
 (0)