Ejemplo n.º 1
0
        private void RenderReturnsBlock(System.Xml.XmlWriter writer, XmlCodeComment comment)
        {
            TypeRef returnTypeRef = _member.GetReturnType();

            if (returnTypeRef == WellKnownTypeDef.Void)
            {
                return;
            }

            writer.WriteStartElement("return");

            // write the details of the type and link details if available
            writer.WriteStartElement("type");
            TypeDef foundEntry = _member.Assembly.FindType(returnTypeRef.Namespace, returnTypeRef.Name);

            writer.WriteAttributeString("name", returnTypeRef.GetDisplayName(false));
            if (foundEntry != null)
            {
                writer.WriteAttributeString("key", foundEntry.GetGloballyUniqueId().ToString());
                writer.WriteAttributeString("cref", CRefPath.Create(foundEntry).ToString());
            }
            writer.WriteEndElement();

            // output the returns comment xml element if available
            if (comment != XmlCodeComment.Empty)
            {
                RenderXmlBlock(writer, comment.Elements.Find(currentBlock => currentBlock is ReturnsXmlCodeElement));
            }

            writer.WriteEndElement();
        }
Ejemplo n.º 2
0
        private void AddReturnDetails(List <Block> parsedBlocks)
        {
            TypeRef returnTypeRef = _method.GetReturnType();

            if (returnTypeRef == WellKnownTypeDef.Void)
            {
                return;
            }

            Blocks.Add(new Header3("Returns"));

            (EntryKey typeKey, string typeName) = CreateEntryKey(returnTypeRef);

            // build the page output
            Inline type = new Run(typeName);

            if (typeKey != null)
            {
                type = new Hyperlink(new Run(typeName));
                ((Hyperlink)type).Tag    = typeKey;
                ((Hyperlink)type).Click += new System.Windows.RoutedEventHandler(LinkHelper.Resolve);
            }

            Blocks.Add(new Paragraph(type));

            if (parsedBlocks != null)
            {
                Block found = parsedBlocks.Find(currentBlock => currentBlock is Returns);
                if (found != null)
                {
                    Blocks.Add(found);
                }
            }
        }