public void ContinueToMain(MainViewModel.SubView? subView = null) { if (MainViewModel == null) MainViewModel = new MainViewModel(); if (subView.HasValue) { switch (subView.Value) { case MainViewModel.SubView.Auction: if (AuctionViewModel == null) AuctionViewModel = new AuctionViewModelDesign(); break; case MainViewModel.SubView.Products: if (ProductsViewModel == null) ProductsViewModel = new ProductsViewModelDesign(); break; } } RunOnUIThread(() => _navigator.NavigateToMainView(subView)); }
/* TODO: For each viewmodel, add a public property with a private setter like this: public _VIEWNAME_ViewModel _VIEWNAME_ViewModel { get; private set; } * Note that the New-View and New-ViewModel commands add the above code automatically (see http://github.com/MacawNL/MvvmQuickCross#new-viewmodel). */ public void ContinueToMain(MainViewModel.SubView? subView = null, bool skipNavigation = false) { if (MainViewModel == null) MainViewModel = new MainViewModel(); if (subView.HasValue) { switch (subView.Value) { case MainViewModel.SubView.Auction: if (AuctionViewModel == null) AuctionViewModel = new AuctionViewModelDesign(); break; case MainViewModel.SubView.Products: if (ProductsViewModel == null) ProductsViewModel = new ProductsViewModelDesign(); break; } } if (!skipNavigation) RunOnUIThread(() => _navigator.NavigateToMainView(CurrentNavigationContext, subView)); }