public MarkupExtensionFormatter(IList <string> singleLineTypes)
        {
            this.singleLineTypes = singleLineTypes;

            this.singleLineFormatter = new SingleLineMarkupExtensionFormatter(this);
            this.multiLineFormatter  = new MultiLineMarkupExtensionFormatter(this);
        }
Exemplo n.º 2
0
        private IEnumerable <string> FormatValue(Value value)
        {
            var type = value.GetType();

            if (type == typeof(LiteralValue))
            {
                return(MarkupExtensionFormatterBase.FormatLiteralValue((LiteralValue)value));
            }

            if (type == typeof(MarkupExtension))
            {
                return(this.FormatArguments((MarkupExtension)value));
            }

            throw new ArgumentException($"Unhandled type {type.FullName}", nameof(value));
        }
Exemplo n.º 3
0
 private IEnumerable <string> FormatNamedArgument(NamedArgument namedArgument)
 {
     return(MarkupExtensionFormatterBase.Format($"{namedArgument.Name}=", this.FormatValue(namedArgument.Value)));
 }
Exemplo n.º 4
0
 public IEnumerable <string> FormatArguments(MarkupExtension markupExtension, bool isNested = false)
 {
     return(markupExtension.Arguments.Any()
         ? MarkupExtensionFormatterBase.Format($"{{{markupExtension.TypeName} ", this.FormatArguments(markupExtension.Arguments, isNested: isNested), "}")
         : new string[] { $"{{{markupExtension.TypeName}}}" });
 }