ReactiveUI icon indicating copy to clipboard operation
ReactiveUI copied to clipboard

Cannot call RegisterAsyncFunction against view-model properties declared as IReactiveAsyncCommand

Open chrisbednarski opened this issue 13 years ago • 6 comments

public class ViewModel : ReactiveObject
{
   public readonly IReactiveAsyncCommand Command { get; private set; }
   public ViewModel()
   {
      Command = new ReactiveAsyncCommand();
      Command
            .RegisterAyncFunction<int>(_ => 1) // fail
            .Subscribe(value => {});
   }
}

RegisterAync... aren't available on the interface

chrisbednarski avatar Feb 27 '13 04:02 chrisbednarski

This seems legit. Can you send a Pull Request to fix this up (i.e. move the Register* series of methods to a static class?)

anaisbetts avatar Feb 28 '13 18:02 anaisbetts

Is it ok if I make it part of ReactiveAsyncCommandMixins and move to another file? https://github.com/reactiveui/ReactiveUI/blob/master/ReactiveUI.Xaml/ReactiveAsyncCommand.cs#L362

chrisbednarski avatar Feb 28 '13 20:02 chrisbednarski

@chrisbednarski Make it part of the Mixins, but leave it in the same file, they're pretty related

anaisbetts avatar Feb 28 '13 21:02 anaisbetts

@xpaulbettsx Could you please cherry-pick from https://github.com/chrisbednarski/ReactiveUI/commit/97a7651ea33d40939b85ac1d00636122d789e477? After I synched up with upstream, the pull request shows 43 commits in it. Not sure how I screwed this up.

chrisbednarski avatar Mar 01 '13 14:03 chrisbednarski

@chrisbednarski Next time, try git pull --rebase - that will put your unique commits at the end instead of mixed into the middle. Another trick you can do if you've only got one unique commit, is to just run git fetch upstream; git reset upstream/master (assuming you've set up the remote to the original repo as 'upstream'), then just recommit your work (reset without --hard won't change your actual files, just what the branch is pointing to).

anaisbetts avatar Mar 02 '13 22:03 anaisbetts

@chrisbednarski Merged, thanks!

anaisbetts avatar Mar 02 '13 22:03 anaisbetts