Exemplo n.º 1
0
        static Func <T, T, bool> GetComp(string x, bool useRefEquality, AbstractPropFactory factory)
        {
            if (useRefEquality)
            {
                return(factory.GetRefEqualityComparer <T>());
            }

            return(null);
        }
Exemplo n.º 2
0
        public PropBagDyn(PropBagTypeSafetyMode typeSafetyMode, AbstractPropFactory thePropFactory)
        {
            if (typeSafetyMode == PropBagTypeSafetyMode.OnlyTypedAccess)
            {
                throw new ApplicationException("OnlyTypedAccess is not supported.");
            }

            propBag = new PubPropBag(typeSafetyMode, thePropFactory);
            InterceptEvents(propBag);
        }
Exemplo n.º 3
0
        // This is not being used as yet. If it is used, it should probably be renamed simply: Create
        static public IProp <T> CreateViaClassGenerator(PropDefRaw def, AbstractPropFactory factory, Type derivedType, out bool typeIsSolid)
        {
            Func <T, T, bool> comparer = GetComp(def.Comparer, def.UseRefEquality, factory);
            EventHandler <PcTypedEventArgs <T> > doWhenChangedX = GetDoWhen(def.DoWhenChanged, derivedType);

            IProp <T> prop;

            typeIsSolid = def.TypeIsSolid;

            if (def.StorageStrategy == PropStorageStrategyEnum.Internal)
            {
                if (def.CreateType == PropCreateMethodEnum.noValue)
                {
                    prop = factory.CreateWithNoValue <T>(def.PropName, def.ExtraInfo, def.StorageStrategy, def.TypeIsSolid, comparer, def.UseRefEquality, null);
                }
                else
                {
                    T initVal;
                    if (def.CreateType == PropCreateMethodEnum.useDefault)
                    {
                        initVal = factory.GetDefaultValue <T>(def.PropName);
                    }
                    else
                    {
                        initVal = factory.GetValueFromString <T>(def.InitialValue);
                    }

                    prop = factory.Create <T>(initVal, def.PropName, def.ExtraInfo, def.StorageStrategy, def.TypeIsSolid, comparer, def.UseRefEquality, null);
                }
            }
            else
            {
                prop = factory.CreateWithNoValue <T>(def.PropName, def.ExtraInfo, def.StorageStrategy, def.TypeIsSolid, comparer, def.UseRefEquality, null);
            }
            return(prop);
        }