Пример #1
0
 public object Calculate(ModelNode node, string propertyName)
 {
     if (node is IModelNodeEnabled)
     {
         var modelNode = ParentCalculator.GetParent(node);
         if (modelNode != null)
         {
             var calculate = modelNode.GetValue(propertyName);
             if (calculate != null && calculate.GetType().IsEnum)
             {
                 var propertyType = node.GetValueInfo(propertyName).PropertyType;
                 if (IsNullableType(propertyType))
                 {
                     var genericArgument = propertyType.GetGenericArguments()[0];
                     if (genericArgument != calculate.GetType())
                     {
                         return(Enum.Parse(genericArgument, ((int)calculate).ToString(CultureInfo.InvariantCulture)));
                     }
                 }
             }
             return(calculate);
         }
     }
     throw new NotImplementedException(propertyName);
 }
Пример #2
0
        public bool IsReadOnly(IModelNode node, string propertyName)
        {
            var parent = ParentCalculator.GetParent(node);
            var helper = new FastModelEditorHelper();

            return(helper.IsPropertyModelBrowsableVisible(parent, propertyName));
        }