Browse Source

Naming.

pull/2943/head
Dariusz Komosinski 7 years ago
parent
commit
f5b317decb
  1. 4
      src/Avalonia.Interactivity/EventSubscription.cs
  2. 10
      src/Avalonia.Interactivity/Interactive.cs

4
src/Avalonia.Interactivity/EventSubscription.cs

@ -5,11 +5,11 @@ using System;
namespace Avalonia.Interactivity namespace Avalonia.Interactivity
{ {
internal delegate void InvokeSignature(Delegate func, object sender, RoutedEventArgs args); internal delegate void HandlerInvokeSignature(Delegate baseHandler, object sender, RoutedEventArgs args);
internal class EventSubscription internal class EventSubscription
{ {
public InvokeSignature InvokeAdapter { get; set; } public HandlerInvokeSignature InvokeAdapter { get; set; }
public Delegate Handler { get; set; } public Delegate Handler { get; set; }

10
src/Avalonia.Interactivity/Interactive.cs

@ -16,7 +16,7 @@ namespace Avalonia.Interactivity
{ {
private Dictionary<RoutedEvent, List<EventSubscription>> _eventHandlers; private Dictionary<RoutedEvent, List<EventSubscription>> _eventHandlers;
private static readonly Dictionary<Type, InvokeSignature> s_invokeCache = new Dictionary<Type, InvokeSignature>(); private static readonly Dictionary<Type, HandlerInvokeSignature> s_invokeHandlerCache = new Dictionary<Type, HandlerInvokeSignature>();
/// <summary> /// <summary>
/// Gets the interactive parent of the object for bubbling and tunneling events. /// Gets the interactive parent of the object for bubbling and tunneling events.
@ -74,11 +74,11 @@ namespace Avalonia.Interactivity
// that will cast our type erased instance and invoke it. // that will cast our type erased instance and invoke it.
Type eventArgsType = routedEvent.EventArgsType; Type eventArgsType = routedEvent.EventArgsType;
if (!s_invokeCache.TryGetValue(eventArgsType, out var invokeAdapter)) if (!s_invokeHandlerCache.TryGetValue(eventArgsType, out var invokeAdapter))
{ {
void InvokeAdapter(Delegate func, object sender, RoutedEventArgs args) void InvokeAdapter(Delegate baseHandler, object sender, RoutedEventArgs args)
{ {
var typedHandler = (EventHandler<TEventArgs>)func; var typedHandler = (EventHandler<TEventArgs>)baseHandler;
var typedArgs = (TEventArgs)args; var typedArgs = (TEventArgs)args;
typedHandler(sender, typedArgs); typedHandler(sender, typedArgs);
@ -86,7 +86,7 @@ namespace Avalonia.Interactivity
invokeAdapter = InvokeAdapter; invokeAdapter = InvokeAdapter;
s_invokeCache.Add(eventArgsType, invokeAdapter); s_invokeHandlerCache.Add(eventArgsType, invokeAdapter);
} }
var subscription = new EventSubscription var subscription = new EventSubscription

Loading…
Cancel
Save