Skip to content

Instantly share code, notes, and snippets.

@runceel
Created February 9, 2015 12:02
Show Gist options
  • Save runceel/28118c56e008c592a361 to your computer and use it in GitHub Desktop.
Save runceel/28118c56e008c592a361 to your computer and use it in GitHub Desktop.
// ネットに接続されてる間はtrueとか
var connected = new BooleanNotifier();
// ダウンロード中はtrueとか
var downloading = new BooleanNotfier();
var command = new[]
{
connected,
downloading.Select(x => !x)
}
.CombineLatest(x => x.All(x => x))
.ToReactiveCommand();
command.Subscribe(_ =>
{
downloading.SwitchValue();
await ダウンロードAsync();
downloading.SwitchValue();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment