public virtual void FillFrom(IMvxValueConverterRegistry registry, Assembly assembly) { var pairs = from type in assembly.ExceptionSafeGetTypes() where type.IsPublic where !type.IsAbstract where typeof (IMvxValueConverter).IsAssignableFrom(type) let name = FindValueConverterName(type) where !string.IsNullOrEmpty(name) where type.IsConventional() select new {Name = name, Type = type}; foreach (var pair in pairs) { try { var converter = Activator.CreateInstance(pair.Type) as IMvxValueConverter; MvxBindingTrace.Trace("Registering value converter {0}:{1}", pair.Name, pair.Type.Name); registry.AddOrOverwrite(pair.Name, converter); } catch (Exception) { // ignore this } } }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); var filler = new MvxInstanceBasedValueConverterRegistryFiller(registry); filler.AddFieldConverters(typeof(Converters)); }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); if (_fillValueConvertersAction != null) _fillValueConvertersAction(registry); }
public virtual void FillFrom(IMvxValueConverterRegistry registry, Type type) { if (type.IsAbstract) { FillFromStatic(registry, type); } else { FillFromInstance(registry, type); } }
protected virtual void FillValueConverters(IMvxValueConverterRegistry registry) { var holders = ValueConverterHolders; if (holders == null) return; var filler = new MvxInstanceBasedValueConverterRegistryFiller(registry); var staticFiller = new MvxStaticBasedValueConverterRegistryFiller(registry); foreach (var converterHolder in holders) { filler.AddFieldConverters(converterHolder); staticFiller.AddStaticFieldConverters(converterHolder); } }
protected virtual void FillFromInstance(IMvxValueConverterRegistry registry, Type type) { var instance = Activator.CreateInstance(type); var pairs = from field in type.GetFields() where !field.IsStatic where field.IsPublic where typeof (IMvxValueConverter).IsAssignableFrom(field.FieldType) let converter = field.GetValue(instance) as IMvxValueConverter where converter != null select new { field.Name, Converter = converter }; foreach (var pair in pairs) { registry.AddOrOverwrite(pair.Name, pair.Converter); } }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); registry.AddOrOverwrite("Language", new MvxLanguageConverter()); }
protected virtual void FillValueConverters(IMvxValueConverterRegistry registry) { registry.AddOrOverwrite("CommandParameter", new MvxCommandParameterValueConverter()); registry.AddOrOverwrite("Language", new MvxLanguageConverter()); }
//this is required, if you want to use app:MvxLang="Text WelcomeText" protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); registry.AddOrOverwrite("Language", new MvxLanguageConverter()); }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); this._fillValueConvertersAction?.Invoke(registry); }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); if (MvxSingleton<IMvxWindowsAssemblyCache>.Instance != null) { foreach (var assembly in MvxSingleton<IMvxWindowsAssemblyCache>.Instance.Assemblies) { registry.Fill(assembly); } } }
protected virtual void FillValueConverters(IMvxValueConverterRegistry registry) { // nothing to do here }
public MvxInstanceBasedValueConverterRegistryFiller(IMvxValueConverterRegistry registry) { _registry = registry; }
public MvxStaticBasedValueConverterRegistryFiller(IMvxValueConverterRegistry registry) { _registry = registry; }
private void FillValueConverters(IMvxValueConverterRegistry registry) { registry.Fill(GetType().Assembly); }
protected void FillValueConverters(IMvxValueConverterRegistry registry) { }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); registry.AddOrOverwrite("IconConverter", new IconConverter()); }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); registry.AddOrOverwrite("CommandParameter", new MvxCommandParameterValueConverter()); }
protected virtual void FillValueConverters(IMvxValueConverterRegistry registry) { registry.Fill(ValueConverterAssemblies); registry.Fill(ValueConverterHolders); }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); //TODO: Do your code here //registry.AddOrOverwrite("BooleanToVisibility", new BooleanToVisibilityConverter()); }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); }
protected virtual void FillValueConverters(IMvxValueConverterRegistry registry) { registry.AddOrOverwriteFrom(GetType().Assembly); registry.AddOrOverwriteFrom(typeof(MvxLanguageConverter).Assembly); }
protected override void FillValueConverters(IMvxValueConverterRegistry registry) { base.FillValueConverters(registry); registry.AddOrOverwrite(nameof(ImageConverter), new ImageConverter()); }