Permalink
Browse files

Fixed bug where handlers are not the same.

  • Loading branch information...
1 parent 7418d14 commit 37eb96e5de0601c307a670a126666a8ef6ad5363 @jlaanstra committed Oct 9, 2012
View
1 .gitignore
@@ -38,3 +38,4 @@ AppPackages/
*.nupkg
*.nuspec
*.suo
+*.suo
View
BIN Windows.UI.Interactivity.v11.suo
Binary file not shown.
View
13 Windows.UI.Interactivity/EventTriggerBase.cs
@@ -24,7 +24,7 @@ public abstract class EventTriggerBase : TriggerBase
private Type sourceTypeConstraint;
private bool isSourceChangedRegistered;
private NameResolver sourceNameResolver;
- private MethodInfo eventHandlerMethodInfo;
+ private Delegate handler;
/// <summary>
/// Gets the type constraint of the associated object.
@@ -408,8 +408,8 @@ private void RegisterEvent(object obj, string eventName)
}
else
{
- this.eventHandlerMethodInfo = typeof(EventTriggerBase).GetTypeInfo().GetDeclaredMethod("OnEventImpl");
- Delegate handler = this.eventHandlerMethodInfo.CreateDelegate(@event.EventHandlerType, this);
+ MethodInfo eventHandlerMethodInfo = typeof(EventTriggerBase).GetTypeInfo().GetDeclaredMethod("OnEventImpl");
+ this.handler = eventHandlerMethodInfo.CreateDelegate(@event.EventHandlerType, this);
WindowsRuntimeMarshal.AddEventHandler<Delegate>(
dlg => (EventRegistrationToken)@event.AddMethod.Invoke(obj, new object[] { dlg }),
@@ -455,15 +455,14 @@ private void UnregisterEvent(object obj, string eventName)
private void UnregisterEventImpl(object obj, string eventName)
{
Type type = obj.GetType();
- if (this.eventHandlerMethodInfo == null)
+ if (this.handler == null)
{
return;
}
EventInfo @event = type.GetRuntimeEvent(eventName);
- Delegate handler = this.eventHandlerMethodInfo.CreateDelegate(@event.EventHandlerType, this);
WindowsRuntimeMarshal.RemoveEventHandler<Delegate>(
- etr => @event.RemoveMethod.Invoke(this.AssociatedObject, new object[] { etr }), handler);
- this.eventHandlerMethodInfo = (MethodInfo)null;
+ etr => @event.RemoveMethod.Invoke(this.AssociatedObject, new object[] { etr }), this.handler);
+ this.handler = null;
}
private void OnEventImpl(object sender, RoutedEventArgs eventArgs)
View
4 Windows.UI.Interactivity/Properties/AssemblyInfo.cs
@@ -24,6 +24,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.7.0")]
-[assembly: AssemblyFileVersion("1.0.7.0")]
+[assembly: AssemblyVersion("1.0.9.0")]
+[assembly: AssemblyFileVersion("1.0.9.0")]
[assembly: ComVisible(false)]

0 comments on commit 37eb96e

Please sign in to comment.