mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
feat: add RouteDescriptorCollectionChanged event to notify changes in route descriptors
This commit is contained in:
parent
aae41b5947
commit
4bb2917b69
1 changed files with 9 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using PepperDash.Core;
|
||||
using System;
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -27,6 +28,8 @@ public class RouteDescriptorCollection
|
|||
|
||||
private readonly List<RouteDescriptor> RouteDescriptors = new List<RouteDescriptor>();
|
||||
|
||||
public event EventHandler RouteDescriptorCollectionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an enumerable collection of all RouteDescriptors in this collection.
|
||||
/// </summary>
|
||||
|
|
@ -70,6 +73,8 @@ public class RouteDescriptorCollection
|
|||
descriptor?.InputPort?.Key ?? "auto",
|
||||
descriptor?.SignalType);
|
||||
RouteDescriptors.Add(descriptor);
|
||||
|
||||
RouteDescriptorCollectionChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -110,7 +115,10 @@ public class RouteDescriptorCollection
|
|||
? GetRouteDescriptorForDestination(destination)
|
||||
: GetRouteDescriptorForDestinationAndInputPort(destination, inputPortKey);
|
||||
if (descr != null)
|
||||
{
|
||||
RouteDescriptors.Remove(descr);
|
||||
RouteDescriptorCollectionChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Information, "Found route descriptor {routeDescriptor}", destination, descr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue