I've got a number of reactive commands as well as some observables holding some information, and I'm trying to do something like:
_navigate = ReactiveCommand.Create(CanNavigate);
_navigate.CombineLatest(navigationTarget, (_, tgt) => tgt)
.Subscribe(tgt => Navigation.NavigateTo(tgt));
I've tried a couple of different approaches:
SelectMany
Zip
I either end up with:
- Subscribe stops invoking after the first time (if I use Zip)
- Subscribe invokes even when the command hasn't been executed after it was executed once
Essentially I want:
An observable that triggers every time (and only) when the command has been executed, along with pulling in the most recent value of the second observable.
Can't quite get my head around how best to achieve this...