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);
            }
        }
Beispiel #7
0
 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());
 }
Beispiel #9
0
 //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());
 }
Beispiel #10
0
        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;
 }
Beispiel #14
0
 public MvxStaticBasedValueConverterRegistryFiller(IMvxValueConverterRegistry registry)
 {
     _registry = registry;
 }
 private void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     registry.Fill(GetType().Assembly);
 }
Beispiel #16
0
 protected void FillValueConverters(IMvxValueConverterRegistry registry)
 {
 }
        protected override void FillValueConverters(IMvxValueConverterRegistry registry)
        {
            base.FillValueConverters(registry);

            registry.AddOrOverwrite("IconConverter", new IconConverter());
        }
Beispiel #18
0
 protected override void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     base.FillValueConverters(registry);
     registry.AddOrOverwrite("CommandParameter", new MvxCommandParameterValueConverter());
 }
 protected virtual void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     // nothing to do here
 }
        protected override void FillValueConverters(IMvxValueConverterRegistry registry)
        {
            base.FillValueConverters(registry);

            this._fillValueConvertersAction?.Invoke(registry);
        }
 protected virtual void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     registry.Fill(ValueConverterAssemblies);
     registry.Fill(ValueConverterHolders);
 }
Beispiel #22
0
 protected override void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     base.FillValueConverters(registry);
     //TODO: Do your code here
     //registry.AddOrOverwrite("BooleanToVisibility", new BooleanToVisibilityConverter());
 }
Beispiel #23
0
 public MvxInstanceBasedValueConverterRegistryFiller(IMvxValueConverterRegistry registry)
 {
     _registry = registry;
 }
Beispiel #24
0
 protected override void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     base.FillValueConverters(registry);
 }
 protected virtual void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     registry.AddOrOverwriteFrom(GetType().Assembly);
     registry.AddOrOverwriteFrom(typeof(MvxLanguageConverter).Assembly);
 }
Beispiel #26
0
 protected override void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     base.FillValueConverters(registry);
     registry.AddOrOverwrite(nameof(ImageConverter), new ImageConverter());
 }
Beispiel #27
0
 protected virtual void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     registry.Fill(ValueConverterAssemblies);
     registry.Fill(ValueConverterHolders);
 }
 protected virtual void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     registry.AddOrOverwrite("CommandParameter", new MvxCommandParameterValueConverter());
     registry.AddOrOverwrite("Language", new MvxLanguageConverter());
 }
 public MvxStaticBasedValueConverterRegistryFiller(IMvxValueConverterRegistry registry)
 {
     _registry = registry;
 }
Beispiel #30
0
 protected override void FillValueConverters(IMvxValueConverterRegistry registry)
 {
     base.FillValueConverters(registry);
 }