コード例 #1
0
        static public PerformanceModel Create(PropBagTypeSafetyMode safetyMode, ViewModelFactoryInterface viewModelFactory)
        {
            AutoMapperHelpers ourHelper      = new AutoMapperHelpers();
            IPropFactory      propFactory_V1 = ourHelper.GetNewPropFactory_V1();

            PropModelType propModel = new PropModel
                                      (
                "PerformanceModel",
                "PropBagLib.Tests",
                DeriveFromClassModeEnum.Custom,
                typeof(PerformanceModel),
                propFactory_V1,
                propFactoryType: null,
                propModelCache: null,
                typeSafetyMode: safetyMode,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true
                                      );

            long generationId = viewModelFactory.PropModelCache.Add(propModel);

            PerformanceModel pmViewModel = new PerformanceModel(propModel, viewModelFactory);

            pmViewModel.AddPropNoStore <int>("PropIntNoStore");
            pmViewModel.AddPropNoStore <string>("PropStringNoStore");
            pmViewModel.AddProp <int>("PropInt");
            pmViewModel.AddProp <string>("PropString");

            pmViewModel.FixProps();

            return(pmViewModel);
        }
コード例 #2
0
        private TDestination GetDestinationTemplate(Type targetType)
        {
            TDestination result = GetNewDestination(DestinationType, PropModel, _viewModelFactory, _propBagMapperService, PropFactory, fullClassName: null);

            if (TestCreateDest(targetType, result))
            {
                // TODO: Consider removing the responsiblity of fixing the store's PropNodeCollection from the AbstractPropBagMapper class.
                if (!PropModel.IsFixed)
                {
                    PropModel.Fix();
                }

                if (!_viewModelFactory.PropStoreAccessServiceCreator.IsPropItemSetFixed(result))
                {
                    // Fix the template's PropNodeCollection to improve performance.
                    PropItemSetKeyType propItemSetKey = new PropItemSetKeyType(PropModel);
                    _viewModelFactory.PropStoreAccessServiceCreator.TryFixPropItemSet(result, propItemSetKey);
                }
            }
            else
            {
                // It turns out that we cannot use the template after all.
                result = null;
            }

            return(result);
        }
コード例 #3
0
        public void Test1()
        {
            AutoMapperHelpers ourHelper      = new AutoMapperHelpers();
            IPropFactory      propFactory_V1 = ourHelper.GetNewPropFactory_V1();

            PropModel pm = new PropModel
                           (
                className: "CreateAtRunTimeModel",
                namespaceName: "PropBagLib.Tests",
                deriveFrom: DeriveFromClassModeEnum.PropBag,
                targetType: null,
                propFactory: propFactory_V1,
                propFactoryType: null,
                propModelCache: null,
                typeSafetyMode: PropBagTypeSafetyMode.AllPropsMustBeRegistered,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true);

            PropItemModel pi = new PropItemModel(typeof(string), "PropString",
                                                 PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop, initialValueField: new PropInitialValueField("Initial Value"));

            pm.Add(pi.PropertyName, pi);


            ViewModelFactoryInterface viewModelFactory = ourHelper.ViewModelFactory;

            viewModelFactory.PropModelCache.Add(pm);

            mod1 = new CreateAtRunTimeModel(pm, viewModelFactory);

            Assert.That(mod1, Is.Not.EqualTo(null), "Expected the CreateAtRunTimeModel to have been created.");

            Assert.That(mod1.PropertyExists("PropString"), Is.True, "Expected the property with name = 'PropString' to have been create.");
        }
コード例 #4
0
        public ActionResult Creat()
        {
            PropModel prop_mod = new PropModel();

            prop_mod.Type = ((int)eSelpropType.Color).ToString();
            InitTypeSel(String.Empty);
            return(View(prop_mod));
        }
コード例 #5
0
        public PropModelType ParsePropModel(IPropBagTemplate pbt)
        {
            if (pbt.ClassName == "PersonCollectionViewModel")
            {
                System.Diagnostics.Debug.WriteLine($"We are processing the {nameof(pbt.ClassName)} PropItem.");
            }

            //DeriveFromClassModeEnum deriveFrom = pbt.DeriveFromClassMode;
            //Type targetType = pbt.TargetType;

            //TypeInfoField wrapperTypeInfoField = GetWrapperTypeInfo(pbt);
            //Type targetTypeFromWTInfoField = GetTypeFromInfoField(wrapperTypeInfoField, PropKindEnum.Prop, targetType, out Type itemTypeDummy);

            PropModelType result = new PropModel
                                   (
                className: pbt.ClassName,
                namespaceName: pbt.OutPutNameSpace,
                deriveFrom: pbt.DeriveFromClassMode,
                targetType: pbt.TargetType,
                propFactory: null,
                propFactoryType: pbt.PropFactoryType,
                propModelCache: null,
                typeSafetyMode: pbt.TypeSafetyMode,
                deferMethodRefResolution: pbt.DeferMethodRefResolution,
                requireExplicitInitialValue: pbt.RequireExplicitInitialValue
                                   );

            // Add Namespaces
            int namespacesCount = pbt.Namespaces == null ? 0 : pbt.Namespaces.Count;

            for (int nsPtr = 0; nsPtr < namespacesCount; nsPtr++)
            {
                result.Namespaces.Add(pbt.Namespaces[nsPtr].Namespace);
            }

            DoWhenChangedHelper doWhenChangedHelper = new DoWhenChangedHelper();

            int propsCount = pbt.Props == null ? 0 : pbt.Props.Count;

            // Parse each Prop Item
            for (int propPtr = 0; propPtr < propsCount; propPtr++)
            {
                IPropTemplateItem pi = pbt.Props[propPtr];

                try
                {
                    IPropItemModel rpi = ProcessProp(pi, doWhenChangedHelper);
                    result.Add(rpi.PropertyName, rpi);
                }
                catch (Exception e)
                {
                    throw new InvalidOperationException($"Error: {e.Message} occured while parsing PropItem: {pi.PropertyName} for class: {pbt.ClassName}.", e);
                }
            }

            return(result);
        }
コード例 #6
0
        private void init(PropModel propModel, IPropFactory propFactory, string listName)
        {
            PbTypeDesc   = null;
            _propModel   = propModel ?? throw new ArgumentNullException(nameof(propModel));
            _propFactory = propFactory ?? throw new ArgumentNullException(nameof(propFactory));
            ListName     = listName ?? throw new ArgumentNullException(nameof(listName));

            //base.CollectionChanged += PbCollection_CollectionChanged;
        }
コード例 #7
0
        public ActionResult Index(int id)
        {
            mSelprop  prop     = item_get.SelpropGet(id);
            PropModel prop_mod = new PropModel {
                Name      = prop.Name,
                Type      = Convert.ToInt32(prop.PropType).ToString(),
                ClassName = prop.ClassName,
            };

            InitTypeSel(prop_mod.Type);
            return(View(prop_mod));
        }
コード例 #8
0
        public MainWindowViewModel(PropModel pm, PSAccessServiceCreatorInterface storeAccessCreator, IPropFactory propFactory, string fullClassName)
            : base(pm, storeAccessCreator, propFactory, fullClassName)
        {
            //System.Diagnostics.Debug.WriteLine("Beginning to construct MainWindowViewModel -- From PropModel.");

            //IHaveADbContext dBActivator = new DBActivator<PersonDB>(System.Environment.SpecialFolder.CommonApplicationData);
            //PersonDB personDb = (PersonDB)dBActivator.DbContext;
            //PersonDAL b = new PersonDAL(personDb);
            //SetIt(b, "Business");

            //System.Diagnostics.Debug.WriteLine("Completed Constructing MainWindowViewModel -- From PropModel.");
        }
コード例 #9
0
        private PropModel GetPropModelForModel3Dest(IPropFactory propFactory)
        {
            PropModel result = new PropModel
                               (
                className: "DestinationModel3",
                namespaceName: "PropBagLib.Tests.AutoMapperSupport",
                deriveFrom: DeriveFromClassModeEnum.Custom,
                targetType: typeof(DestinationModel3),
                propFactory: propFactory,
                propFactoryType: null,
                propModelCache: null,
                typeSafetyMode: PropBagTypeSafetyMode.Tight,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true
                               );

            //result.Namespaces.Add("System");
            result.Namespaces.Add("DRM.PropBag");
            result.Namespaces.Add("DRM.TypeSafePropertyBag");

            // ProductId (Guid - default)
            IPropInitialValueField pivf = PropInitialValueField.UseDefault;

            PropItemModel propItem = new PropItemModel(type: typeof(Guid), name: "ProductId",
                                                       storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                                       initialValueField: pivf);

            result.Add(propItem.PropertyName, propItem);

            // Amount (int - default)
            propItem = new PropItemModel(type: typeof(int), name: "Amount",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);


            // Size (double - default)
            propItem = new PropItemModel(type: typeof(double), name: "Size",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            // Deep (MyModel4 - null)
            pivf = PropInitialValueField.UseNull;

            propItem = new PropItemModel(type: typeof(MyModel4), name: "Deep",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            return(result);
        }
コード例 #10
0
        public PropModelType GetPropModelForModel5Dest(IPropFactory propFactory, PropModelCacheInterface propModelCache)
        {
            PropModelType result = new PropModel
                                   (
                className: "DestinationModel5",
                namespaceName: "PropBagLib.Tests.PerformanceDb",
                deriveFrom: DeriveFromClassModeEnum.Custom,
                targetType: typeof(DestinationModel5),
                propFactory: propFactory,
                propFactoryType: null,
                propModelCache: null,
                typeSafetyMode: PropBagTypeSafetyMode.Tight,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true
                                   );

            result.Namespaces.Add("System");
            result.Namespaces.Add("DRM.PropBag");
            result.Namespaces.Add("DRM.TypeSafePropertyBag");

            // ProductId (Guid - default)
            IPropInitialValueField pivf = PropInitialValueField.UseDefault;

            PropItemModel propItem = new PropItemModel(type: typeof(Guid), name: "ProductId",
                                                       storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                                       initialValueField: pivf);

            result.Add(propItem.PropertyName, propItem);


            // Business (Business - null)
            pivf = PropInitialValueField.UseNull;

            propItem = new PropItemModel(type: typeof(Business), name: "Business",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);


            // PersonCollection (ObservableCollection<Person> - null)
            propItem = new PropItemModel(type: typeof(ObservableCollection <Person>), name: "PersonCollection",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.ObservableCollection,
                                         initialValueField: pivf, itemType: typeof(Person));
            result.Add(propItem.PropertyName, propItem);

            result.Open();

            propModelCache.Add(result);

            return(result);
        }
コード例 #11
0
        public ActionResult Creat(PropModel prop_mod)
        {
            if (!ModelState.IsValid)
            {
                return(View(prop_mod));
            }
            mSelprop prop = new mSelprop {
                Name      = prop_mod.Name,
                ClassName = prop_mod.ClassName,
                PropType  = (eSelpropType)int.Parse(prop_mod.Type)
            };

            item_sub.SelpropAdd(prop);
            return(RedirectToAction("List", "Prop", new { id = 1 }));
        }
コード例 #12
0
        public ActionResult Index(int id, PropModel prop_mod)
        {
            InitTypeSel(prop_mod.Type);
            if (!ModelState.IsValid)
            {
                return(View(prop_mod));
            }
            mSelprop prop = item_get.SelpropGet(id);

            prop.Name      = prop_mod.Name;
            prop.ClassName = prop_mod.ClassName;
            prop.PropType  = (eSelpropType)int.Parse(prop_mod.Type);
            item_sub.SelpropUpdate(prop);
            return(View(prop_mod));
        }
コード例 #13
0
        public void CanRegisterMod3ToDestinationMapper_Proxy()
        {
            IPropFactory propFactory = _propFactory_V1;
            ViewModelFactoryInterface viewModelFactory = _viewModelFactory;

            PropModel propModel         = GetPropModelForModel3Dest(propFactory);
            Type      typeToWrap        = typeof(PropBag);
            string    configPackageName = "Emit_Proxy";

            //IMapperRequest mr = new MapperRequest(typeof(MyModel3), propModel, configPackageName);

            IPropBagMapperRequestKeyGen mapperRequest =
                _amp.SubmitPropBagMapperRequest(propModel, typeof(MyModel3), configPackageName);


            Assert.That(mapperRequest, Is.Not.Null, "mapperRequest should be non-null.");
        }
コード例 #14
0
ファイル: ModelUICache.cs プロジェクト: davetz/ModelGraph2
        private void AddCheckProperty()
        {
            var obj = CheckProperty;

            if (obj == null)
            {
                obj = CheckProperty = new CheckBox();

                obj.Style       = TC.CheckPropertyStyle;
                obj.GotFocus   += TC.CheckProperty_GotFocus;
                obj.Checked    += TC.CheckProperty_Checked;
                obj.Unchecked  += TC.CheckProperty_Checked;
                obj.KeyDown    += TC.Check_KeyDown;
                obj.DataContext = this;
            }

            obj.IsChecked = PropModel.GetBoolValue(DataRoot);

            StackPanel.Children.Add(obj);
        }
コード例 #15
0
ファイル: ModelUICache.cs プロジェクト: davetz/ModelGraph2
        private void AddComboProperty()
        {
            var obj = ComboProperty;

            if (obj == null)
            {
                obj = ComboProperty = new ComboBox();

                obj.Style             = TC.ComboPropertyStyle;
                obj.GotFocus         += TC.ComboProperty_GotFocus;
                obj.SelectionChanged += TC.ComboProperty_SelectionChanged;
                obj.KeyDown          += TC.ComboProperty_KeyDown;
                obj.DataContext       = this;
            }

            obj.ItemsSource   = PropModel.GetlListValue(DataRoot);
            obj.SelectedIndex = PropModel.GetIndexValue(DataRoot);

            StackPanel.Children.Add(obj);
        }
コード例 #16
0
ファイル: CardDetailView.cs プロジェクト: linxscc/LoveGame
    /// <summary>
    /// 关卡掉落后需要更新升级道具
    /// </summary>
    /// <param name="propModel"></param>
    public void UpdatePropNum(PropModel propModel)
    {
        for (int i = 0; i < _propsTran.childCount; i++)
        {
            var numText = _propsTran.GetChild(i).Find("RedCirclePoint/RedNum").GetComponent <Text>();
            numText.text = propModel.GetUserProp(PropConst.CardUpgradePropSmall + i).Num.ToString();
            switch (PropConst.CardUpgradePropSmall + i)
            {
            case PropConst.CardUpgradePropSmall:
                _intsmallPropNum = propModel.GetUserProp(PropConst.CardUpgradePropSmall + i).Num;
                break;

            case PropConst.CardUpgradePropBig:
                _intbigPropNum = propModel.GetUserProp(PropConst.CardUpgradePropSmall + i).Num;
                break;

            case PropConst.CardUpgradePropLarge:
                _intlargePropNum = propModel.GetUserProp(PropConst.CardUpgradePropSmall + i).Num;
                break;
            }
        }
    }
コード例 #17
0
ファイル: GlobalData.cs プロジェクト: linxscc/LoveGame
        public static void InitData()
        {
            VersionData = new VersionData();

            ConfigModel = new ConfigModel();

            PlayerModel = new PlayerModel();

            CardModel = new CardModel();

            PropModel = new PropModel();

            NpcModel = new NpcModel();

            PhoneData = new PhoneData();

            FavorabilityMainModel = new FavorabilityMainModel();

            DiaryElementModel = new DiaryElementModel();

            ActivityModel = new ActivityModel();

            PayModel = new PayModel();

            RandomEventModel = new RandomEventModel();

            NoticeData = new NoticeData();

            LevelModel = new LevelModel();

            AppointmentData = new AppointmentModel();

            TrainingRoomModel = new TrainingRoomModel();


            MissionModel = new MissionModel();

            CapsuleLevelModel = new CapsuleLevelModel();
        }
コード例 #18
0
ファイル: ModelUICache.cs プロジェクト: davetz/ModelGraph2
        private void AddTextProperty()
        {
            var obj = TextProperty;

            if (obj == null)
            {
                obj = TextProperty = new TextBox();

                obj.Style       = TC.TextPropertyStyle;
                obj.KeyDown    += TC.TextProperty_KeyDown;
                obj.LostFocus  += TC.TextProperty_LostFocus;
                obj.GotFocus   += TC.TextProperty_GotFocus;
                obj.DataContext = this;
            }

            var txt = PropModel.GetTextValue(DataRoot);

            obj.Text       = txt ?? string.Empty;
            obj.Tag        = obj.Text;
            obj.IsReadOnly = PropModel.IsReadOnly;

            StackPanel.Children.Add(obj);
        }
コード例 #19
0
        public void CanGetMapperForMod3ToDestination_Proxy()
        {
            IPropFactory propFactory = _propFactory_V1;
            ViewModelFactoryInterface viewModelFactory = _viewModelFactory;

            PropModel propModel = GetPropModelForModel3Dest(propFactory);

            viewModelFactory.PropModelCache.Add(propModel);

            Type   typeToWrap        = typeof(PropBag);
            string configPackageName = "Emit_Proxy";

            IMapperRequest mapperRequest = new MapperRequest(typeof(MyModel3), propModel, configPackageName);

            Type et = _wrapperTypeCreator_V1.GetWrapperType(propModel, typeToWrap);

            propModel.NewEmittedType = et;

            IPropBagMapperRequestKeyGen mapperKey = _amp.SubmitPropBagMapperRequest(mapperRequest.PropModel,
                                                                                    mapperRequest.SourceType, mapperRequest.ConfigPackageName);

            // Get the AutoMapper mapping function associated with the mapper request already submitted.
            IPropBagMapperGen genMapper = _amp.GetPropBagMapper(mapperKey);

            //IMapper genMapper = _amp.GetRawAutoMapper(mapperKey);

            Assert.That(mapperKey, Is.Not.Null, "mapperRequest should be non-null.");

            //IPropBagMapper<MyModel3, DestinationModel3> mapper = _amp.GetMapper<MyModel3, DestinationModel3>(mapperRequest);

            Assert.That(genMapper, Is.Not.Null, "mapper should be non-null");

            MyModel4 dp = new MyModel4
            {
                MyString = "This is a good thing."
            };

            MyModel3 testSource = new MyModel3
            {
                Amount    = 11,
                Size      = 22.22,
                ProductId = Guid.Empty,
                Deep      = dp
            };

            var testDest = genMapper.MapToDestination(testSource);

            //IPropBagMapperKey<MyModel3, DestinationModel3> mapperRequest2 =
            //    _amp.SubmitMapperRequest<MyModel3, DestinationModel3>
            //    (
            //        propModel: propModel,
            //        typeToWrap: typeToWrap,
            //        configPackageName: configPackageName
            //    );

            //IPropBagMapper<MyModel3, DestinationModel3> mapper2 = _amp.GetMapper<MyModel3, DestinationModel3>(mapperRequest2);

            IPropBagMapperRequestKeyGen mapperKey2 = _amp.SubmitPropBagMapperRequest(mapperRequest.PropModel,
                                                                                     mapperRequest.SourceType, mapperRequest.ConfigPackageName);

            // Get the AutoMapper mapping function associated with the mapper request already submitted.
            IPropBagMapperGen genMapper2 = _amp.GetPropBagMapper(mapperKey2);


            var testDest2 = genMapper2.MapToDestination(testSource);
        }
コード例 #20
0
ファイル: Product.ashx.cs プロジェクト: uvbs/mmp
        /// <summary>
        /// 获取商品规格
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Property(HttpContext context)
        {
            string productId = context.Request["product_id"];
            //1:1:尺码:XS;2:2:颜色:红色
            var                      skuList      = bllMall.GetProductSkuList(int.Parse(productId));
            List <string>            propIdList   = new List <string>();//获取商品拥有的所有属性ID集合
            Dictionary <int, string> propKeyValue = new Dictionary <int, string>();

            foreach (var sku in skuList)
            {
                if (!string.IsNullOrEmpty(sku.PropValueIdEx1) && !string.IsNullOrEmpty(sku.PropValueIdEx2))
                {
                    sku.Props = bllMall.GetProductProperties(sku.SkuId);//兼容efast同步
                }
                if (string.IsNullOrEmpty(sku.Props))
                {
                    return("");
                }
                foreach (var item in sku.Props.Split(';'))
                {
                    string propId = item.Split(':')[0];
                    if (!propIdList.Contains(propId))
                    {
                        propIdList.Add(propId);
                        string propName = item.Split(':')[2];
                        var    prop     = bllMall.Get <ProductProperty>(string.Format("PropId={0}", propId));
                        if (prop != null)
                        {
                            propName = prop.PropName;
                        }
                        propKeyValue.Add(int.Parse(propId), propName);
                    }
                }
            }

            List <PropModel> data = new List <PropModel>();

            foreach (var propId in propIdList)
            {
                PropModel model = new PropModel();
                model.name   = propKeyValue[int.Parse(propId)];
                model.values = new List <Values>();
                foreach (var sku in skuList)
                {
                    foreach (var item in sku.Props.Split(';'))
                    {
                        string propIdNew     = item.Split(':')[0];
                        string propValue     = item.Split(':')[1];
                        string propValueName = item.Split(':')[3];
                        if (propId == propIdNew)
                        {
                            Values valueModel = new Values();
                            valueModel.p_id = int.Parse(propId);
                            valueModel.v_id = int.Parse(propValue);

                            BLLJIMP.Model.ProductPropertyValue propValueInfo = bllMall.GetProductPropertyValue(valueModel.v_id);
                            //valueModel.value = propValueName;
                            valueModel.value   = propValueInfo.PropValue;
                            valueModel.sku_img = sku.SkuImg;
                            if (model.values.Where(p => p.v_id == valueModel.v_id).Count() == 0)
                            {
                                model.values.Add(valueModel);
                            }
                        }
                    }
                }

                data.Add(model);
            }

            return(ZentCloud.Common.JSONHelper.ObjectToJson(new
            {
                totalcount = data.Count,
                list = data
            }));
        }
コード例 #21
0
 public PersonVM(PropModel pm, PSAccessServiceCreatorInterface storeAccessCreator, IPropFactory propFactory, string fullClassName)
     : base(pm, storeAccessCreator, propFactory, fullClassName)
 {
 }
コード例 #22
0
        public void CanGetMapperForMod3ToDestination_Extra()
        {
            IPropFactory propFactory = _propFactory_V1;
            ViewModelFactoryInterface viewModelFactory = _viewModelFactory;

            PropModel propModel = GetPropModelForModel3Dest(propFactory);

            viewModelFactory.PropModelCache.Add(propModel);

            Type   typeToWrap        = typeof(DestinationModel3); // typeof(PropBag);
            string configPackageName = "Extra_Members";           // "Emit_Proxy";


            IMapperRequest mr = new MapperRequest(typeof(MyModel3), propModel, configPackageName);

            //IMapper rawAutoMapper = AutoMapperHelpers.GetAutoMapper<MyModel3, DestinationModel3>
            //    (
            //    mr,
            //    _amp,
            //    out IPropBagMapperKey<MyModel3, DestinationModel3> propBagMapperKey
            //    );

            //IPropBagMapper<MyModel3, DestinationModel3> cookedAutoMapper = new SimplePropBagMapper<MyModel3, DestinationModel3>
            //    (
            //    propBagMapperKey,
            //    rawAutoMapper,
            //    viewModelFactory,
            //    _amp
            //    );

            IPropBagMapper <MyModel3, DestinationModel3> propBagMapper = AutoMapperHelpers.GetAutoMapper <MyModel3, DestinationModel3>
                                                                         (
                mr,
                _amp,
                out IPropBagMapperRequestKey <MyModel3, DestinationModel3> propBagMapperKey
                                                                         );


            //IPropBagMapperKey<MyModel3, DestinationModel3> mapperRequest =
            //    _amp.SubmitMapperRequest<MyModel3, DestinationModel3>
            //    (
            //        propModel: propModel,
            //        viewModelFactory: viewModelFactory,
            //        typeToWrap: typeToWrap,
            //        configPackageName: configPackageName
            //    );

            Assert.That(propBagMapperKey, Is.Not.Null, "mapperRequest should be non-null.");

            //IPropBagMapper<MyModel3, DestinationModel3> mapper = _amp.GetMapper<MyModel3, DestinationModel3>(mapperRequest);

            Assert.That(propBagMapper, Is.Not.Null, "mapper should be non-null");

            MyModel4 dp = new MyModel4
            {
                MyString = "This is a good thing."
            };

            MyModel3 testSource = new MyModel3
            {
                Amount    = 11,
                Size      = 22.22,
                ProductId = Guid.Empty,
                Deep      = dp
            };


            DestinationModel3 testDest = propBagMapper.MapToDestination(testSource);

            //IPropBagMapperKey<MyModel3, DestinationModel3> mapperRequest2 =
            //    _amp.SubmitMapperRequest<MyModel3, DestinationModel3>
            //    (
            //        propModel: propModel,
            //        viewModelFactory: viewModelFactory,
            //        typeToWrap: typeToWrap,
            //        configPackageName: configPackageName
            //    );

            //IPropBagMapper<MyModel3, DestinationModel3> mapper2 = _amp.GetMapper<MyModel3, DestinationModel3>(mapperRequest2);


            IPropBagMapper <MyModel3, DestinationModel3> propBagMapper2 = AutoMapperHelpers.GetAutoMapper <MyModel3, DestinationModel3>
                                                                          (
                mr,
                _amp,
                out IPropBagMapperRequestKey <MyModel3, DestinationModel3> propBagMapperKey2
                                                                          );

            //IPropBagMapper<MyModel3, DestinationModel3> cookedAutoMapper2 = new SimplePropBagMapper<MyModel3, DestinationModel3>
            //    (
            //    propBagMapperKey,
            //    rawAutoMapper,
            //    viewModelFactory,
            //    _amp
            //    );

            DestinationModel3 testDest2 = propBagMapper2.MapToDestination(testSource);
        }
コード例 #23
0
        //public CreateAtRunTimeModel(PropBagTypeSafetyMode typeSafetyMode, PSAccessServiceCreatorInterface storeAccessCreator,
        //    IPropFactory propFactory, string fullClassName)
        //    : base(typeSafetyMode, storeAccessCreator, propFactory, fullClassName)
        //{
        //}

        public CreateAtRunTimeModel(PropModel pm, ViewModelFactoryInterface viewModelFactory)
            : base(pm, viewModelFactory, null, propFactory: null, fullClassName: "PropBagLib.Tests.CreateAtRunTimeModel")
        {
        }
コード例 #24
0
        //int ITEMS_PER_PAGE = 10;

        public PersonCollectionViewModel(PropModel pm, PSAccessServiceCreatorInterface storeAccessCreator, IPropFactory propFactory, string fullClassName)
            : base(pm, storeAccessCreator, propFactory, fullClassName)
        {
            System.Diagnostics.Debug.WriteLine("Constructing PersonCollectionViewModel -- with PropModel.");
        }
コード例 #25
0
        public PropModelType GetPropModelForModel1Dest(IPropFactory propFactory, PropModelCacheInterface propModelCache)
        {
            PropModelType result = new PropModel
                                   (
                className: "DestinationModel1",
                namespaceName: "PropBagLib.Tests.PerformanceDb",
                deriveFrom: DeriveFromClassModeEnum.Custom,
                targetType: typeof(DestinationModel1),
                propFactory: propFactory,
                propFactoryType: null,
                propModelCache: null, //propModelCache,
                typeSafetyMode: PropBagTypeSafetyMode.Tight,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true
                                   );

            result.Namespaces.Add("System");
            result.Namespaces.Add("DRM.PropBag");
            result.Namespaces.Add("DRM.TypeSafePropertyBag");

            // Id (Int - 0)
            IPropInitialValueField pivf = new PropInitialValueField(initialValue: "0");

            PropItemModel propItem = new PropItemModel(type: typeof(int), name: "Id",
                                                       storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                                       initialValueField: pivf);

            result.Add(propItem.PropertyName, propItem);

            pivf = PropInitialValueField.UseNull;

            // First Name (string - null)
            propItem = new PropItemModel(type: typeof(string), name: "FirstName",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            // Last Name (string - null)
            propItem = new PropItemModel(type: typeof(string), name: "LastName",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            // City Of Residence (string - null)
            propItem = new PropItemModel(type: typeof(string), name: "CityOfResidence",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            pivf = PropInitialValueField.UseDefault;

            // Profession
            propItem = new PropItemModel(type: typeof(Profession), name: "Profession",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            result.Open();

            propModelCache.Add(result);

            return(result);
        }
コード例 #26
0
        public PropModelType GetPropModelForModel6Dest(IPropFactory propFactory, PropModelCacheInterface propModelCache)
        {
            PropModelType result = new PropModel
                                   (
                className: "DestinationModel6",
                namespaceName: "PropBagLib.Tests.PerformanceDb",
                deriveFrom: DeriveFromClassModeEnum.Custom,
                targetType: typeof(DestinationModel6),
                propFactory: propFactory,
                propFactoryType: null,
                propModelCache: null,
                typeSafetyMode: PropBagTypeSafetyMode.Tight,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true
                                   );

            result.Namespaces.Add("System");
            result.Namespaces.Add("DRM.PropBag");
            result.Namespaces.Add("DRM.TypeSafePropertyBag");

            // Business (Business - null)
            IPropInitialValueField pivf = PropInitialValueField.UseNull;

            PropItemModel propItem = new PropItemModel(type: typeof(Business), name: "Business",
                                                       storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                                       initialValueField: pivf);

            result.Add(propItem.PropertyName, propItem);

            //// PersonCollection (ObservableCollection<Person> - null)
            //pivf = new PropInitialValueField(initialValue: null,
            //    setToDefault: false, setToUndefined: false, setToNull: true, setToEmptyString: false);

            //propItem = new PropItem(type: typeof(ObservableCollection<Person>), name: "PersonCollection",
            //    hasStore: true, propKind: PropKindEnum.Collection,
            //    propTypeInfoField: null,
            //    initialValueField: pivf,
            //    doWhenChanged: null, extraInfo: null, comparer: null, itemType: typeof(Person));
            //result.Props.Add(propItem);

            // ChildVM (DestinationModel5 - null)
            propItem = new PropItemModel(type: typeof(DestinationModel5), name: "ChildVM",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            // SelectedPerson (Business - null)
            propItem = new PropItemModel(type: typeof(Person), name: "SelectedPerson",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            // WMessage (String - null)
            propItem = new PropItemModel(type: typeof(string), name: "WMessage",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            result.Open();

            propModelCache.Add(result);

            return(result);
        }
コード例 #27
0
 public void Post([FromBody] PropModel value)
 {
 }
コード例 #28
0
ファイル: CardDetailView.cs プロジェクト: linxscc/LoveGame
    /// <summary>
    /// 赋值主通道
    /// </summary>
    /// <param name="userCardVo"></param>
    /// <param name="propModel"></param>
    /// <param name="addExp"></param>
    /// <param name="starupsuccess"></param>
    public void SetData(UserCardVo userCardVo, PropModel propModel, bool addExp = false, bool starupsuccess = false)
    {
        GlobalData.CardModel.CurCardVo = userCardVo;
        _callTimes     = 0;
        _userCardVo    = userCardVo;
        _starUpSuccess = starupsuccess;
        ChangeCondiction(_userCardVo);
        SetCardBg(_userCardVo);


        _curLevelExp = userCardVo.CurrentLevelExp;
        _needExp     = userCardVo.NeedExp;

        //Debug.LogWarning("cardDetailView SetData:" + addExp + "oldLevel:"+ oldLevel + " userCard lv:"+ _userCardVo.Level);
        if (!addExp || _userCardVo.Level <= oldLevel)
        {
            ChangePropView(userCardVo, addExp);
        }
        //经验信息
        UpdateExpInfo(addExp);

        //升星道具
        UpdateStarPropNum(userCardVo, addExp);

        //升级道具

        //Debug.LogError(userCardVo.Level+" "+ _userCardVo.UpgradeRequireLevel);
        if (userCardVo.Level < _userCardVo.UpgradeRequireLevel)
        {
            _upgradeLevelProps.gameObject.SetActive(true);
            _upgradeOneLevel.gameObject.SetActive(true);
            _leveluplimittext.gameObject.SetActive(false);
            Text expText;
            for (int i = 0; i < _propsTran.childCount; i++)
            {
                expText      = _propsTran.GetChild(i).Find("ExpText").GetComponent <Text>();
                expText.text = "+" + propModel.GetPropBase(PropConst.CardUpgradePropSmall + i).Exp;
            }

            _upgradeTips.text = I18NManager.Get("Card_LevelUptoStarUp");
        }
        else
        {
            _upgradeLevelProps.gameObject.SetActive(userCardVo.Level < _userCardVo.CardVo.MaxLevel);
            _upgradeOneLevel.gameObject.SetActive(userCardVo.Level < _userCardVo.CardVo.MaxLevel);
            _leveluplimittext.gameObject.SetActive(userCardVo.Level >= _userCardVo.CardVo.MaxLevel);
            //等级达到上限的Text!只有切换到升星的时候才会显示。
            _leveluplimittext.GetComponent <Text>().text = I18NManager.Get("Card_HasMaxLevel");//"+"userCardVo.Level < _userCardVo.CardVo.MaxLevel ? I18NManager.Get("Card_StarupTips") :

            _upgradeTips.text = I18NManager.Get("Card_NeedMoreLevel");
        }
        UpdatePropNum(propModel);
        _levelOneBtn.image.color = userCardVo.Level < _userCardVo.UpgradeRequireLevel ? Color.white : Color.gray;

        SetStarEffectIndex(starupsuccess);
        //_evolutionBtn.gameObject.SetActive(userCardVo.Star>=3);

        ShowEvoSelect();

        hassignature = _userCardVo.SignatureCard != null;
        _signature.gameObject.SetActive(hassignature);
        if (hassignature)
        {
            _signature.texture = ResourceManager.Load <Texture>("Prop/Signature/sign" + (int)_userCardVo.CardVo.Player);
            _signature.SetNativeSize();
        }

        starUpPreviewBtn.gameObject.SetActive(GuideManager.IsPass1_9());

        _starupRedPoint.gameObject.SetActive(userCardVo.ShowUpgradeStarRedpoint);
        _evolutionRedPoint.gameObject.SetActive(userCardVo.ShowEvolutionRedPoint);


        _loveBtn.gameObject.SetActive(userCardVo.CardVo.Credit != CreditPB.R);
        _AppointmentVo = userCardVo.CardAppointmentRuleVo;
        _loveRedPoint.gameObject.SetActive(userCardVo.ShowLovePoint);
    }
コード例 #29
0
        /// <summary>
        /// Constructor used by View to create with properties
        /// </summary>
        /// <param name="pm"></param>

        // TODO: AAA
        public DtoTestViewModelEmit(PropModel pm) : base(pm, null, null, null)
        {
            // Save a reference to the model used to defined our properties.
            _pm = pm;
        }
コード例 #30
0
 void Start()
 {
     string    json = File.ReadAllText("/FirstProp.json", Encoding.UTF8);
     PropModel test = JsonUtility.FromJson <PropModel>(json);
 }