Ejemplo n.º 1
0
        /// <summary>
        ///     Loads the current module.
        /// </summary>
        protected override bool LoadInternal()
        {
            //NOTE: You can use the custom extension methods in bindings.
            BindingServiceProvider
            .ResourceResolver
            .AddType(typeof(CustomExtensionMethods).Name, typeof(CustomExtensionMethods));

            if (Mode == LoadMode.Design)
            {
                var localizationManager = new LocalizationManager();
                localizationManager.Initilaize();
                if (IocContainer != null)
                {
                    IocContainer.BindToConstant <ILocalizationManager>(localizationManager);
                }
            }
            else
            {
                if (!IocContainer.CanResolve <ILocalizationManager>())
                {
                    IocContainer.BindToMethod <ILocalizationManager>((container, list) =>
                    {
                        var localizationManager = new LocalizationManager();
                        localizationManager.Initilaize();
                        return(localizationManager);
                    }, DependencyLifecycle.SingleInstance);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
 public void BindToMethod(Type service,
                          Func <IIocContainer, IList <IIocParameter>, object> methodBindingDelegate, DependencyLifecycle lifecycle,
                          string name = null)
 {
     if (_isMixed && _parentInitialized)
     {
         if (!IsContainerDisposed(_parentContainer))
         {
             _parentContainer.BindToMethod(service, methodBindingDelegate, lifecycle, name);
         }
         _iocContainer.BindToMethod(service, methodBindingDelegate, lifecycle, name);
     }
     else
     {
         IocContainer.BindToMethod(service, methodBindingDelegate, lifecycle, name);
     }
 }
Ejemplo n.º 3
0
        protected override bool LoadInternal()
        {
#if NETFX_CORE
            IocContainer.BindToMethod <ILocalizationManager>((container, list) =>
            {
                var manager = new LocalizationManagerExt();
                manager.Initilaize();
                return(manager);
            }, DependencyLifecycle.SingleInstance);
#endif

            //Registering attached property
            IBindingMemberProvider memberProvider = BindingServiceProvider.MemberProvider;
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <TextBlock, string>("TextExt",
                                                                                                 TextExtMemberChanged, TextExtMemberAttached, TextExtGetDefaultValue));

            memberProvider.Register(AttachedBindingMember.CreateMember <TextBlock, string>("FormattedText",
                                                                                           GetFormattedTextValue, SetFormattedTextValue, ObserveFormattedTextValue));
            return(true);
        }