Created
September 13, 2019 07:05
-
-
Save bbenetskyy/a11dee25934ca88ac31e08bb8fbcc0d3 to your computer and use it in GitHub Desktop.
MvxTabbedPage ViewModel with navigation for all child tabs
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 HomeViewModel : MvxViewModel | |
{ | |
private readonly IMvxNavigationService _navigationService; | |
private bool _firstTime = true; | |
private IMvxViewModel _previousViewModel; | |
public HomeViewModel(IMvxNavigationService navigationService) | |
{ | |
_navigationService = navigationService; | |
} | |
private Task ShowInitialViewModels() | |
{ | |
var tasks = new List<Task> | |
{ | |
_navigationService.Navigate<DetailsViewModel>(), | |
_navigationService.Navigate<SecondDetailsViewModel>(), | |
_navigationService.Navigate<ThirdDetailsViewModel>() | |
}; | |
return Task.WhenAll(tasks); | |
} | |
public override void ViewAppearing() | |
{ | |
if (_firstTime) | |
{ | |
ShowInitialViewModels(); | |
_firstTime = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment