예제 #1
0
 private void DoRebuild()
 {
     lock (this)
     {
         if (!_needsRebuild || ParentContainer == null)
         {
             return;
         }
         bool hasCallback = false;
         HasDecision = !string.IsNullOrEmpty(ConditionID);
         DoDestroy();
         _propWrapper = PropertyWrapper.Create(GetFullID(), typeof(bool), OnPropertyChanged);
         if (_propWrapper != null && _propWrapper.Target is CompBase)
         {
             _propertyExpression = _propWrapper.GetGetPropExpression <bool>() as Expression <Func <bool> >;
             if (_propertyExpression != null)
             {
                 U.RegisterOnChanged(_propertyExpression, OnBoolPropertyChanged);
                 //(_propWrapper.Target as CompBase).RegisterOnChanged(_propertyExpression, OnBoolPropertyChanged);
                 hasCallback = true;
             }
             else
             {
                 _propWrapper = null;
             }
         }
         HasCallback   = hasCallback;
         _needsRebuild = false;
     }
 }
예제 #2
0
        private void DoRebuild()
        {
            lock (this)
            {
                if (!_needsRebuild)
                {
                    return;
                }

                //DoDestroy();

                _propWrapperSource  = null;
                _propWrapperCompare = null;

                System.Reflection.PropertyInfo sourcePropInfo = U.GetPropertyInfo(this.ConditionID);
                Type sourcePropType = sourcePropInfo.PropertyType;
                _propWrapperSource = PropertyWrapper.Create(ConditionID, sourcePropType, null);

                //Convert Compare Value
                if (ConditionValueString.Contains("(Object)"))
                {
                    if (_propWrapperSource.PropertyType.IsSubclassOf(typeof(MDouble.MDoubleBase)))
                    {
                        var compareVal = Double.Parse(ConditionValueString.Replace("(Object)", ""));
                        _fixCompareValue = compareVal;
                    }
                    else
                    {
                        var compareVal = TypeDescriptor.GetConverter(_propWrapperSource.PropertyType).ConvertFromString(ConditionValueString.Replace("(Object)", ""));
                        _fixCompareValue = compareVal;
                    }
                }
                else
                {
                    System.Reflection.PropertyInfo comparePropInfo = U.GetPropertyInfo(this.ConditionValueString);
                    Type comparePropType = comparePropInfo.PropertyType;
                    _propWrapperCompare = PropertyWrapper.Create(ConditionValueString, comparePropType, null);
                }

                //Pre-Validate
                Validate();
                _needsRebuild = false;
            }
        }