public IObservable<Unit> Save() { return Observable.Create<Unit>( o => { State = ModelState.Processing; return Observable.Timer(TimeSpan.FromSeconds(2)) .Select(_ => Unit.Default) .Finally(() => State = ModelState.Idle) .Subscribe(o); }); }
public IDisposable AddCountries(IObservable<IList<ICountry>> countriesSequence) { State = ModelState.Processing; return countriesSequence.Subscribe(countries => { foreach (var country in countries) { _availableCountries.Add(country); } }, () => State = ModelState.Idle); }