You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.
In it's constructor, MvxTextProviderBuilder calls its LoadResources method which refers to the virtual property ResourceFiles. This is an issue as we might access stuff that isn't completely initialized yet, as we well know.
My specific use-case is that I'm passing my default text type key as a parameter to my text provider class. I also use reflection to find all ViewModels and create the mappings for those classes. Of course, my default type key is null when trying to setup the dictionary. Ideally, the initial loading of text resources would be deferred.
public TextProviderBuilder(string textFolder, string defaultTypeKey)
: base(Mvx.Resolve<ResourceLocator>().ResourcesNamespace, textFolder, new MvxEmbeddedJsonDictionaryTextProvider(false))
{
_DefaultTypeKey = defaultTypeKey;
}
protected override IDictionary<string, string> ResourceFiles
{
get
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
IEnumerable<TypeInfo> localizedViewModelTypes = Mvx.Resolve<ResourceLocator>()
.ResourcesAssembly.DefinedTypes.Where(
t => t.IsSubclassOf(typeof(MvxLocalizedViewModel)));
dictionary.Add(_DefaultTypeKey, _DefaultTypeKey);
foreach(TypeInfo type in localizedViewModelTypes)
{
string typeKey = type.FullName;
dictionary.Add(typeKey, typeKey);
}
return dictionary;
}
}
The text was updated successfully, but these errors were encountered:
In it's constructor, MvxTextProviderBuilder calls its LoadResources method which refers to the virtual property ResourceFiles. This is an issue as we might access stuff that isn't completely initialized yet, as we well know.
My specific use-case is that I'm passing my default text type key as a parameter to my text provider class. I also use reflection to find all ViewModels and create the mappings for those classes. Of course, my default type key is null when trying to setup the dictionary. Ideally, the initial loading of text resources would be deferred.
The text was updated successfully, but these errors were encountered: