// todo: do we need this functionality? internal static TViewModel RegisterView <TViewModel>( Page page) where TViewModel : class, IViewModel { var viewType = page.GetType(); var registrationInfo = new NavigationRegistration { ViewModelType = typeof(TViewModel), ViewType = viewType }; RegisterInternal(registrationInfo); var cachedPage = new CachedPage(page); PageCache.Add(cachedPage); var viewModel = dependencyResolver.Resolve <TViewModel>(); if (viewModel != null) { TaskHelper.RunSync( viewModel.InitializeAsync); } return(viewModel); }
private static void CreateCachedPage( Type pageType) { if (!Configuration.CacheContent) { return; } if (Configuration.ContentTypesToExcludeFromCaching? .Contains(pageType) == true) { return; } var pageInstance = (Page)Activator.CreateInstance( pageType); var cachedPage = new CachedPage(pageInstance); PageCache.Add(cachedPage); }