1
0

Use Action instead of custom event delegate

This commit is contained in:
glax 2024-09-06 00:50:49 +02:00
parent 7b06587b33
commit d127bb1374
2 changed files with 4 additions and 4 deletions

View File

@ -92,7 +92,7 @@ public class OSC : IDisposable
internal void AddEndpoint(OSCEndpoint oscEndpoint) =>
AddEndpoint(oscEndpoint.Endpoint, oscEndpoint.Type, oscEndpoint.Callback);
internal void AddEndpoint(string endpoint, Type type, OnParameterChangeEventHandler? callback = null)
internal void AddEndpoint(string endpoint, Type type, Action<string, object?, object?>? callback = null)
{
this._logger?.LogDebug($"Adding endpoint {endpoint}");
Dictionary<Type, string> oscTypeLookup = new Dictionary<Type, string>()
@ -113,7 +113,7 @@ public class OSC : IDisposable
this._oscServer.TryAddMethod(endpoint, values => HandleParameterChange(endpoint, type, values, callback));
}
private void HandleParameterChange(string endpoint, Type type, OscMessageValues values, OnParameterChangeEventHandler? callback)
private void HandleParameterChange(string endpoint, Type type, OscMessageValues values, Action<string, object?, object?>? callback)
{
object? oldValue = ParameterValues[endpoint];
if (type == typeof(int))

View File

@ -4,9 +4,9 @@ public struct OSCEndpoint
{
public string Endpoint;
public Type Type;
public OSC.OnParameterChangeEventHandler? Callback;
public Action<string, object?, object?>? Callback;
public OSCEndpoint(string endpoint, Type type, OSC.OnParameterChangeEventHandler? callback)
public OSCEndpoint(string endpoint, Type type, Action<string, object?, object?>? callback)
{
this.Endpoint = endpoint;
this.Type = type;