Exemple #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);
        }
Exemple #2
0
        public void SetInt1000WithTypeTypedSub()
        {
            mod1 = PerformanceModel.Create(PropBagTypeSafetyMode.AllPropsMustBeRegistered, _viewModelFactory);
            mod1.SubscribeToPropChanged <int>(Mod1_PropertyChangedTyped, "PropInt");

            for (int cntr = 0; cntr < InterationCount - 1; cntr++)
            {
                //mod1.SetIt<int>(cntr, "PropInt");
                mod1.PropInt = cntr;
            }
        }
Exemple #3
0
        public void SetInt1000WithTypeDirect()
        {
            mod1 = PerformanceModel.Create(PropBagTypeSafetyMode.AllPropsMustBeRegistered, _viewModelFactory);
            mod1.PropertyChanged  += Mod1_PropertyChanged;
            mod1.PropertyChanged2 += Mod1_PropertyChanged2;

            for (int cntr = 0; cntr < InterationCount - 1; cntr++)
            {
                mod1.SetIt <int>(cntr, "PropInt");
            }
        }
Exemple #4
0
        public void SetInt1000Regular()
        {
            mod1 = PerformanceModel.Create(PropBagTypeSafetyMode.AllPropsMustBeRegistered, _viewModelFactory);
            mod1.PropertyChanged  += Mod1_PropertyChanged;
            mod1.PropertyChanged2 += Mod1_PropertyChanged2;

            for (int cntr = 0; cntr < InterationCount - 1; cntr++)
            {
                mod1.PropIntStandard = cntr;
            }
        }
Exemple #5
0
        public void SetInt1000Index()
        {
            mod1 = PerformanceModel.Create(PropBagTypeSafetyMode.None, _viewModelFactory);
            mod1.PropertyChanged  += Mod1_PropertyChanged;
            mod1.PropertyChanged2 += Mod1_PropertyChanged2;

            for (int cntr = 0; cntr < InterationCount - 1; cntr++)
            {
                mod1[typeof(int), "PropInt"] = cntr;
                //mod1["System.Int32","PropInt"] = cntr;
            }
        }
Exemple #6
0
        public void SetInt1000UsingTypeProp()
        {
            mod1 = PerformanceModel.Create(PropBagTypeSafetyMode.AllPropsMustBeRegistered, _viewModelFactory);
            mod1.PropertyChanged  += Mod1_PropertyChangedNoStore;
            mod1.PropertyChanged2 += Mod1_PropertyChanged2;

            IProp <int> typedProp = mod1.GetTypedProp <int>("PropInt", mustBeRegistered: true, neverCreate: false);

            for (int cntr = 0; cntr < InterationCount - 1; cntr++)
            {
                typedProp.TypedValue = cntr;
            }
        }
Exemple #7
0
        public void SetString1000WithNoStore()
        {
            mod1 = PerformanceModel.Create(PropBagTypeSafetyMode.AllPropsMustBeRegistered, _viewModelFactory);
            mod1.PropertyChanged  += Mod1_PropertyChangedNoStore;
            mod1.PropertyChanged2 += Mod1_PropertyChanged2;

            string val;

            for (int cntr = 0; cntr < InterationCount - 1; cntr++)
            {
                val = cntr.ToString();
                mod1.PropStringNoStore = val;
            }
        }
Exemple #8
0
        public void SetString1000NoType()
        {
            mod1 = PerformanceModel.Create(PropBagTypeSafetyMode.None, _viewModelFactory);
            mod1.PropertyChanged  += Mod1_PropertyChanged;
            mod1.PropertyChanged2 += Mod1_PropertyChanged2;

            string val;

            for (int cntr = 0; cntr < InterationCount - 1; cntr++)
            {
                val = cntr.ToString();
                mod1["System.String", "PropString"] = val;
            }
        }
Exemple #9
0
 public void Destroy()
 {
     mod1.Dispose();
     mod1 = null;
 }