Пример #1
0
        /// <summary>
        /// Ensure the prototype is well-formed.
        /// </summary>
        private MarkupControlInstance VerifyPrototype(MarkupNode node)
        {
            if (node is MarkupControlInstance)
            {
                return (MarkupControlInstance) node;
            }
            if (node is MarkupElementCollection)
            {
                // There should be only one non-whitespace node in the collection.
                try
                {
                    MarkupElement element = ((MarkupElementCollection) node)
                        .Single(item => !item.IsWhiteSpace());
                    if (element is MarkupControlInstance)
                    {
                        return (MarkupControlInstance) element;
                    }
                }
                catch (InvalidOperationException)
                {
                }
            }

            throw new CompilerException(
                "A control's <prototype> must be a single instance of a QuickUI control class.");
        }
Пример #2
0
 private string EmitBaseClassProperty(string propertyName, MarkupNode propertyValue, int indentLevel)
 {
     return Template.Format(
        "{Tabs}\"{PropertyName}\": {PropertyValue}",
        new
        {
            Tabs = Tabs(indentLevel),
            PropertyName = propertyName,
            PropertyValue = propertyValue.JavaScript(indentLevel)
        });
 }