Created
March 25, 2022 12:55
-
-
Save rdelrosario/11c1e3956511ad5472f24502db58742c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 abstract class StartupPage : ContentPage, IStartupTask | |
| { | |
| protected virtual Task<bool> CanRunAsync() => Task.FromResult(true); | |
| protected async Task CompleteAsync() | |
| { | |
| await Navigation.PopModalAsync(false); | |
| _tcs?.SetResult(true); | |
| } | |
| Task<bool> IStartupTask.CanRunAsync() => CanRunAsync(); | |
| async Task IStartupTask.RunAsync() | |
| { | |
| _tcs = new TaskCompletionSource<bool>(); | |
| await App.Current.MainPage.Navigation.PushModalAsync(this); | |
| await _tcs.Task; | |
| } | |
| private TaskCompletionSource<bool> _tcs; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment