Created
March 15, 2017 00:50
-
-
Save yuka1984/c7f942b604eda0c36838884ee04f802b 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 MainPageViewModel | |
{ | |
IService _service; | |
public MainPageViewModel(IService service, INavigation navigation) | |
{ | |
_service = service; | |
Time = service.Time.Do(x => { Debug.WriteLine($"{x} Debug"); }).Select(x => $"{x} 回目").ToReadOnlyReactiveProperty(); | |
CountUpCommand = new AsyncReactiveCommand(); | |
CountUpCommand.Subscribe(async _ => { | |
GC.Collect(); | |
await Task.Delay(500); | |
_service.SetTime(); | |
}); | |
GoNextPageCommand = new AsyncReactiveCommand(); | |
GoNextPageCommand.Subscribe(async _ => { | |
await navigation.PushAsync(new MainPage { BindingContext = new MainPageViewModel(_service, navigation) }); | |
}); | |
} | |
public ReadOnlyReactiveProperty<string> Time { get; } | |
public AsyncReactiveCommand CountUpCommand { get; } | |
public AsyncReactiveCommand GoNextPageCommand { get; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment