Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Async/Await in Actions #112

Open
Duranom opened this issue Sep 20, 2016 · 1 comment
Open

Support for Async/Await in Actions #112

Duranom opened this issue Sep 20, 2016 · 1 comment

Comments

@Duranom
Copy link

Duranom commented Sep 20, 2016

XamlBehaviors are really powerfull and more lately noticed that some designers are going faster with productivity with the more small components made into it. But we are running into some small behaviors/actions issue when it comes to actions that require async/await.

A common scenario that we have is that the we have a lot of small actions that help the designers just plug in the feature where needed and out later instead of in code, this really sped up a lot of implementations and requirements but we are having issues when the designers need to do few actions in a row. For example assume there are 3 actions required to be executed but the second one is a IO operation with Async execute only that you either need to await or .Wait/Result and the third action relies on it. Currently you now either perform a blocking UI action while you want fluent UI or do in code behind (and dozen of places).

I would like to propose an addition of an IAwaitableAsync with the method Task Execute(object sender, object parameter);
SideNote: Maybe even introduce a base class like with Behavior, one named BehaviorAction and AwaitableBehaviorAction

There are few critical changes that would be required though, like the Interaction.ExecuteActions would have to do a blocking support or replaced by a new method named Interaction.ExecuteActionsAsync.
All Behaviors of the package would have to use that method to support Async/Await.
CallMethodAction should also ignore the check if a method returns nothing to match the perfect signature and in case it returns a Task it should await it.

@il-frans
Copy link

Bumping this as I came across this issue, or am I missing something? Using EventTriggerBehavior -> CallMethodAction does not support async methods as far as I could tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants