public static Page ResolveViewModel(TinyViewModel viewModel, NavigationParameters parameters = null)
        {
            TinyIOC.Container.BuildUp(ref viewModel);
            var pageName = ViewModelMapper.GetPageTypeName(viewModel.GetType());
            var pageType = Type.GetType(pageName);

            if (pageType == null)
            {
                throw new Exception(pageName + " not found");
            }

            Page page = (Page)TinyIOC.Container.Resolve(pageType);

            return(BindingPageModel(page, viewModel, parameters));
        }
示例#2
0
 public static Type GetPageTypeForViewModel(Type viewModelType)
 {
     if (ViewModelMappings.ContainsKey(viewModelType))
     {
         return(ViewModelMappings[viewModelType]);
     }
     else
     {
         var pageName = ViewModelMapper.GetPageTypeName(viewModelType);
         var pageType = Type.GetType(pageName);
         if (pageType == null)
         {
             Debug.WriteLine($"No map for ${viewModelType} was found on navigation mappings");
         }
         return(pageType);
     }
 }