当前位置: 首页>>代码示例>>C#>>正文


C# SyntaxWriter.WriteStartBlock方法代码示例

本文整理汇总了C#中SyntaxWriter.WriteStartBlock方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxWriter.WriteStartBlock方法的具体用法?C# SyntaxWriter.WriteStartBlock怎么用?C# SyntaxWriter.WriteStartBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SyntaxWriter的用法示例。


在下文中一共展示了SyntaxWriter.WriteStartBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteSyntax

        /// <inheritdoc />
        public override void WriteSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            writer.WriteStartBlock(this.Language, this.StyleId);

            // Check the list of assemblies for which to generate XAML syntax
            string assemblyName = (string)reflection.Evaluate(apiContainingAssemblyExpression);
            string namespaceName = (string)reflection.Evaluate(apiContainingNamespaceNameExpression);

            if(!xamlAssemblies.ContainsKey(assemblyName))
            {
                WriteXamlBoilerplate(XamlBoilerplateID.nonXamlAssemblyBoilerplate, writer);
            }
            else
            {
                string group = (string)reflection.Evaluate(apiGroupExpression);
                switch(group)
                {
                    case "namespace":
                        WriteNamespaceSyntax(reflection, writer);
                        break;
                    case "type":
                        WriteTypeSyntax(reflection, writer);
                        break;
                    case "member":
                        WriteMemberSyntax(reflection, writer);
                        break;
                }
                WriteXamlXmlnsUri(assemblyName, namespaceName, writer);
            }

            writer.WriteEndBlock();
        }
开发者ID:natarajanmca11,项目名称:SHFB,代码行数:33,代码来源:XamlUsageSyntax.cs

示例2: WritePropertySyntax

        /// <summary>
        /// Write out property syntax
        /// </summary>
        /// <param name="reflection">An XPath navigator containing the member information</param>
        /// <param name="writer">The syntax writer to which the information is written</param>
        /// <param name="prefix">The web control prefix to use</param>
        private static void WritePropertySyntax(XPathNavigator reflection, SyntaxWriter writer, string prefix)
        {
            bool set = (bool)reflection.Evaluate(propertyIsSettable);

            if(!set)
                return;

            string name = (string)reflection.Evaluate(nameExpression);
            string declaringType = (string)reflection.Evaluate(declaringTypeExpression);
            string propertyType = (string)reflection.Evaluate(propertyTypeExpression);

            bool isInnerProperty = (bool)reflection.Evaluate(propertyIsInnerProperty);

            writer.WriteStartBlock(LanguageName, StyleIdName);

            if(isInnerProperty)
            {
                // inner property logic
                writer.WriteString("<");
                writer.WriteString(prefix);
                writer.WriteString(":");
                writer.WriteReferenceLink(declaringType);
                writer.WriteString(">");

                writer.WriteLine();
                writer.WriteString("\t");

                writer.WriteString("<");
                writer.WriteString(name);
                writer.WriteString(">");

                if(String.IsNullOrEmpty(propertyType))
                    writer.WriteParameter("value");
                else
                    if(propertyType == "T:System.Boolean")
                        writer.WriteString("True|False");
                    else
                        writer.WriteReferenceLink(propertyType);

                writer.WriteString("</");
                writer.WriteString(name);
                writer.WriteString(">");

                writer.WriteLine();

                writer.WriteString("</");
                writer.WriteString(prefix);
                writer.WriteString(":");
                writer.WriteReferenceLink(declaringType);
                writer.WriteString(">");
            }
            else
            {
                // normal property logic
                writer.WriteString("<");
                writer.WriteString(prefix);
                writer.WriteString(":");
                writer.WriteReferenceLink(declaringType);
                writer.WriteString(" ");
                writer.WriteString(name);
                writer.WriteString("=\"");

                if(String.IsNullOrEmpty(propertyType))
                    writer.WriteParameter("value");
                else
                    if(propertyType == "T:System.Boolean")
                        writer.WriteString("True|False");
                    else
                        writer.WriteReferenceLink(propertyType);

                writer.WriteString("\" />");
            }

            writer.WriteEndBlock();
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:81,代码来源:AspNetSyntax.cs

示例3: WriteEventSyntax

        /// <summary>
        /// Write out event syntax
        /// </summary>
        /// <param name="reflection">An XPath navigator containing the member information</param>
        /// <param name="writer">The syntax writer to which the information is written</param>
        /// <param name="prefix">The web control prefix to use</param>
        private static void WriteEventSyntax(XPathNavigator reflection, SyntaxWriter writer, string prefix)
        {
            string name = (string)reflection.Evaluate(nameExpression);
            string declaringType = (string)reflection.Evaluate(declaringTypeExpression);
            string handlerType = (string)reflection.Evaluate(eventHandlerTypeExpression);

            writer.WriteStartBlock(LanguageName, StyleIdName);

            writer.WriteString("<");
            writer.WriteString(prefix);
            writer.WriteString(":");
            writer.WriteReferenceLink(declaringType);
            writer.WriteString(" ");
            writer.WriteString("On");
            writer.WriteString(name);
            writer.WriteString("=\"");
            writer.WriteReferenceLink(handlerType);
            writer.WriteString("\" />");

            writer.WriteEndBlock();
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:27,代码来源:AspNetSyntax.cs

示例4: WriteClassSyntax

        /// <summary>
        /// Write out class syntax
        /// </summary>
        /// <param name="reflection">An XPath navigator containing the member information</param>
        /// <param name="writer">The syntax writer to which the information is written</param>
        /// <param name="prefix">The web control prefix to use</param>
        private static void WriteClassSyntax(XPathNavigator reflection, SyntaxWriter writer, string prefix)
        {
            string name = (string)reflection.Evaluate(nameExpression);

            writer.WriteStartBlock(LanguageName, StyleIdName);

            writer.WriteString("<");
            writer.WriteString(prefix);
            writer.WriteString(":");
            writer.WriteString(name);
            writer.WriteString(" />");

            writer.WriteEndBlock();
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:20,代码来源:AspNetSyntax.cs


注:本文中的SyntaxWriter.WriteStartBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。