/// <summary>
 /// Returns to the previous page if this page was called from the profile or settings page
 /// </summary>
 public void ReturnToPreviousPage()
 {
     if (parentViewModel.GetType() == typeof(ProfileScreenViewModel))
     {
         var mainPageViewModel = new MainPageViewModel();
         Navigation.StartNewNavigationStack(mainPageViewModel);
         mainPageViewModel.SwitchToProfileView();
     }
     else if (parentViewModel.GetType() == typeof(SettingsScreenViewModel))
     {
         var mainPageViewModel = new MainPageViewModel();
         Navigation.StartNewNavigationStack(mainPageViewModel);
         mainPageViewModel.SwitchToSettingsScreenView();
     }
 }
예제 #2
0
        public IViewFor InstantiateView(NavigationViewModel viewModel)
        {
            // Figure out what type the view model is
            var viewModelType = viewModel.GetType();

            // look up what type of view it corresponds to
            var viewType = viewModelViewDictionary[viewModelType];

            // instantiate it
            var view = (IViewFor)Activator.CreateInstance(viewType);

            ((BindableObject)view).BindingContext = viewModel;

            return(view);
        }