コード例 #1
0
        private static ControlInfoJson.RuleEntry GetPropertyEntry(ControlState state, ErrorContainer errors, string propName, string expression)
        {
            var property = new ControlInfoJson.RuleEntry();

            property.Property        = propName;
            property.InvariantScript = expression;

            PropertyState propState = null;

            if (state.Properties != null && state.Properties.ToDictionary(prop => prop.PropertyName).TryGetValue(propName, out propState))
            {
                property.ExtensionData    = propState.ExtensionData;
                property.NameMap          = propState.NameMap;
                property.RuleProviderType = propState.RuleProviderType;
            }
            else
            {
                if (state.IsComponentDefinition ?? false)
                {
                    errors.UnsupportedOperationError("This tool currently does not support adding new custom properties to components. Please use Power Apps Studio to edit component definitions");
                    throw new DocumentException();
                }

                property.RuleProviderType = "Unknown";
            }

            return(property);
        }
コード例 #2
0
        private static (PropertyNode prop, PropertyState state) SplitProperty(ControlInfoJson.RuleEntry rule)
        {
            var script = rule.InvariantScript;
            var prop   = new PropertyNode()
            {
                Expression = new ExpressionNode()
                {
                    Expression = script
                }, Identifier = rule.Property
            };
            var state = new PropertyState()
            {
                PropertyName = rule.Property, ExtensionData = rule.ExtensionData, NameMap = rule.NameMap, RuleProviderType = rule.RuleProviderType
            };

            return(prop, state);
        }
コード例 #3
0
        private static ControlInfoJson.RuleEntry CombinePropertyIRAndState(PropertyNode node, ErrorContainer errors, ControlState state = null)
        {
            var propName   = node.Identifier;
            var expression = node.Expression.Expression;

            if (state == null)
            {
                var property = new ControlInfoJson.RuleEntry();
                property.Property         = propName;
                property.InvariantScript  = expression;
                property.RuleProviderType = "Unknown";
                return(property);
            }
            else
            {
                var property = GetPropertyEntry(state, errors, propName, expression);
                return(property);
            }
        }
コード例 #4
0
        private static ControlInfoJson.DynamicPropertyJson CombineDynamicPropertyIRAndState(PropertyNode node, ControlState state = null)
        {
            var propName   = node.Identifier;
            var expression = node.Expression.Expression;

            if (state == null)
            {
                var property = new ControlInfoJson.RuleEntry();
                property.Property         = propName;
                property.InvariantScript  = expression;
                property.RuleProviderType = "Unknown";
                return(new ControlInfoJson.DynamicPropertyJson()
                {
                    PropertyName = propName, Rule = property
                });
            }
            else
            {
                var property = GetDynamicPropertyEntry(state, propName, expression);
                return(property);
            }
        }