Use Action instead of custom event delegate
This commit is contained in:
parent
7b06587b33
commit
d127bb1374
@ -92,7 +92,7 @@ public class OSC : IDisposable
|
|||||||
internal void AddEndpoint(OSCEndpoint oscEndpoint) =>
|
internal void AddEndpoint(OSCEndpoint oscEndpoint) =>
|
||||||
AddEndpoint(oscEndpoint.Endpoint, oscEndpoint.Type, oscEndpoint.Callback);
|
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}");
|
this._logger?.LogDebug($"Adding endpoint {endpoint}");
|
||||||
Dictionary<Type, string> oscTypeLookup = new Dictionary<Type, string>()
|
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));
|
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];
|
object? oldValue = ParameterValues[endpoint];
|
||||||
if (type == typeof(int))
|
if (type == typeof(int))
|
||||||
|
@ -4,9 +4,9 @@ public struct OSCEndpoint
|
|||||||
{
|
{
|
||||||
public string Endpoint;
|
public string Endpoint;
|
||||||
public Type Type;
|
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.Endpoint = endpoint;
|
||||||
this.Type = type;
|
this.Type = type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user