From a4b7a0c55ca33b37935aab7ac80c1205a7190b56 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Tue, 10 Mar 2015 16:15:59 +1300 Subject: [PATCH] Hold a reference to Message in Action.Invoke. Resolves #133 --- src/Caliburn.Micro.Platform/Action.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Caliburn.Micro.Platform/Action.cs b/src/Caliburn.Micro.Platform/Action.cs index 20770245a..7b18bd375 100644 --- a/src/Caliburn.Micro.Platform/Action.cs +++ b/src/Caliburn.Micro.Platform/Action.cs @@ -101,6 +101,9 @@ public static bool HasTargetSet(DependencyObject element) { /// The event args. /// The method parameters. public static void Invoke(object target, string methodName, DependencyObject view = null, FrameworkElement source = null, object eventArgs = null, object[] parameters = null) { + + var message = new ActionMessage {MethodName = methodName}; + var context = new ActionExecutionContext { Target = target, #if WinRT @@ -108,7 +111,7 @@ public static void Invoke(object target, string methodName, DependencyObject vie #else Method = target.GetType().GetMethod(methodName), #endif - Message = new ActionMessage {MethodName = methodName}, + Message = message, View = view, Source = source, EventArgs = eventArgs