Created
April 29, 2014 13:18
-
-
Save ionoy/11400074 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainViewModel : ReactiveObject | |
{ | |
public MainViewModel() | |
{ | |
LoadTweetsCommand = new ReactiveCommand(); | |
LoadTweetsCommand.RegisterAsync(_ => { | |
throw new Exception("AA"); | |
return LoadTweets(); | |
}).Subscribe(x => TheTweets = x); | |
var errorMessage = "The Tweets could not be loaded"; | |
var errorResolution = "Check your Internet connection"; | |
// Any exceptions thrown by LoadTweets will end up being | |
// sent through ThrownExceptions | |
LoadTweetsCommand.ThrownExceptions | |
.Select(ex => new UserError(errorMessage, errorResolution)) | |
.SelectMany(UserError.Throw) | |
.Where(x => x == RecoveryOptionResult.RetryOperation) | |
.InvokeCommand(LoadTweetsCommand); | |
UserError.RegisterHandler(e => Observable.Return(RecoveryOptionResult.)); | |
} | |
public int TheTweets { get; set; } | |
private IObservable<int> LoadTweets() | |
{ | |
return Observable.Return(0); | |
} | |
public ReactiveCommand LoadTweetsCommand { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment