Example #1
0
 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);
         });
 }
Example #2
0
 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);
 }