public async Task <Type> ResolveViewTypeForAsync(Type viewModelType, bool throwOnError = false) { await CrossTask.Yield(); var key = viewModelType; if (_Map.ContainsKey(key)) { return(_Map[key]); } if (throwOnError) { throw new ViewNotFoundException(key); } return(null); }
public async Task <Type> ResolveViewTypeForAsync(Type viewModelType, bool throwOnError = false) { await CrossTask.Yield(); IncludeOriginatingAssemblyName(viewModelType); var typeInfo = viewModelType.GetTypeInfo(); foreach (var assembly in Assemblies) { var types = assembly.GetViewTypesFor(viewModelType); if (types == null || types.Count() <= 0) { continue; } return(types.First()); } return(null); }
public async Task <Type> ResolveViewTypeForAsync(Type viewModelType, bool throwOnError = false) { await CrossTask.Yield(); IncludeOriginatingAssemblyName(viewModelType); foreach (var assemblyName in AssemblyNames) { foreach (var convention in _Conventions) { foreach (var viewName in convention.GetPossibleViewNamesFor(viewModelType)) { var viewFullName = viewName.FullName; var assemblyQualifiedViewTypeName = $"{viewFullName}, {assemblyName}"; OnResolvingView(viewModelType, assemblyQualifiedViewTypeName); var viewType = Type.GetType(assemblyQualifiedViewTypeName); if (viewType == null) { continue; } if (viewType == viewModelType) { continue; } return(viewType); } } } if (throwOnError) { throw new ViewNotFoundException(viewModelType); } return(null); }