AvaloniaUI/Avalonia.Xaml.Behaviors

CallMethodAction with async methods

mightypanda opened this issue · 1 comments

Hello and thank you for this beautiful piece of software!
I noticed that async methods, returning Task, are not supported by CallMethodAction.
Is it difficult to add this possibility?
Thank you

Hello Wieslaw,
I had the need for a new project and just created a clone of your CallMethodAction.
I needed just to add the check for the returntype being a Task, and it worked flawlessly.

CallMethodAction.cs line 181
if (string.Equals(method.Name, MethodName, StringComparison.Ordinal) && (method.ReturnType == typeof(void) || method.ReturnType == typeof(System.Threading.Tasks.Task)) && method.IsPublic)

Maybe you can integrate it into your new releases.

Best