Skip to content

Commit

Permalink
refactor: #13 changed callback handler's properties to events.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroxpepe committed Mar 10, 2021
1 parent 19b6c8a commit 6826dbe
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions MidiPlayer.FluidSynth/Synth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,30 @@ public static bool Playing {
get => ready;
}

public static Func<IntPtr, IntPtr, int> OnMessage {
get => onMessage;
set {
///////////////////////////////////////////////////////////////////////////////////////////////
// static Events [adjective]

public static event Func<IntPtr, IntPtr, int> OnMessage {
add {
onMessage += value;
event_callback = new handle_midi_event_func_t(onMessage);
}
remove => onMessage -= value;
}

public static Action OnStart {
get => onStart;
set => onStart += value;
public static event Action OnStart {
add => onStart += value;
remove => onStart -= value;
}

public static Action OnEnd {
get => onEnd;
set => onEnd += value;
public static event Action OnEnd {
add => onEnd += value;
remove => onEnd -= value;
}

public static Action<object, PropertyChangedEventArgs> OnUpdate {
get => onUpdate;
set => onUpdate += value;
public static event Action<object, PropertyChangedEventArgs> OnUpdate {
add => onUpdate += value;
remove => onUpdate -= value;
}

///////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 6826dbe

Please sign in to comment.