Skip to content

Commit

Permalink
Cleaning some code
Browse files Browse the repository at this point in the history
  • Loading branch information
arielbh committed Sep 22, 2012
1 parent 84e5efb commit 6781d0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
13 changes: 4 additions & 9 deletions ReactiveUI.Samples.Basics/ViewModels/MainViewModel.cs
Expand Up @@ -31,19 +31,14 @@ public MainViewModel()
//Throttling the updates for the SlowProgress, Actually we can accomplish it with a few ways
//@xpaulbettsx is there a better way?
// 1:
this.ObservableForProperty(vm => vm.Progress).Throttle(TimeSpan.FromSeconds(1)).Subscribe(
Observer.Create<IObservedChange<MainViewModel, int>>(c =>
this.ObservableForProperty(vm => vm.Progress).Throttle(TimeSpan.FromSeconds(1)).Subscribe(c =>
{
SlowProgress = Progress;
}));
});
// 2:
this.WhenAny(vm => vm.Progress, model => true).Throttle(TimeSpan.FromSeconds(1), RxApp.DeferredScheduler).Subscribe(
Observer.Create<bool>(c =>
{
SlowProgress2 = Progress;
}));
this.WhenAny(vm => vm.Progress, model => true).Throttle(TimeSpan.FromSeconds(1), RxApp.DeferredScheduler).
Subscribe(c => SlowProgress2 = Progress);

Person = new PersonViewModel();
Calculator = new CalculatorViewModel();
Expand Down
10 changes: 3 additions & 7 deletions ReactiveUI.Samples.Basics/ViewModels/PersonViewModel.cs
@@ -1,4 +1,5 @@
using System.Reactive;
using System;
using System.Reactive;
using ReactiveUI;

namespace ReactiveUI.Samples.Basics.ViewModels
Expand All @@ -8,12 +9,7 @@ public class PersonViewModel : ReactiveValidatedObject

public PersonViewModel()
{
ValidationObservable.Subscribe(Observer.Create<IObservedChange<object, bool>>(x =>
{
IsValid = this.IsObjectValid();
}));
ValidationObservable.Subscribe(x => IsValid = this.IsObjectValid());
}
private int _Age;

Expand Down

0 comments on commit 6781d0a

Please sign in to comment.