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

Combined commands #382

Merged
merged 3 commits into from
Oct 2, 2013
Merged

Combined commands #382

merged 3 commits into from
Oct 2, 2013

Conversation

anaisbetts
Copy link
Member

This PR adds a feature to ReactiveCommand to create a ReactiveCommand that invokes several sub-commands, and whose CanExecute reflects whether all of the child commands can execute. Here's how it works:

var cmd1 = new ReactiveCommand();
var cmd2 = new ReactiveCommand();

cmd1.Subscribe(_ => Console.WriteLine("Command One ran!"));
cmd2.Subscribe(_ => Console.WriteLine("Command Two ran!"));

var newCommand = ReactiveCommand.CreateCombined(cmd1, cmd2, cmd3);

newCommand.Execute(null);

>>> Command One ran!
>>> Command Two ran!

@anaisbetts
Copy link
Member Author

/cc @haacked

anaisbetts pushed a commit that referenced this pull request Oct 2, 2013
@anaisbetts anaisbetts merged commit a9ba820 into master Oct 2, 2013
@haacked
Copy link
Contributor

haacked commented Oct 2, 2013

Holy shit this is so little code! 👍 Does it pass all the tests we have in GHfW? Great stuff!

@anaisbetts anaisbetts deleted the combined-commands branch December 16, 2013 02:19
@lock lock bot locked and limited conversation to collaborators Jun 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants