コード例 #1
0
        private static void BuildReferenceBookItems(Guid parentId, Dictionary <Guid, IDataObject> objects, IList <string> categories, string stringFormat, List <ReferenceBookItem> result, IList <string> typesToShow, IAttributeFormatParser attributeFormatParser)
        {
            var children = GetSortedChildren(parentId, objects, typesToShow);

            if (children == null)
            {
                return;
            }

            foreach (var child in children)
            {
                var title = child.DisplayName;
                if (IsLeaf(child))
                {
                    var formattedTitle = string.IsNullOrEmpty(stringFormat)
                        ? title
                        : attributeFormatParser.AttributesFormat(stringFormat, child.Attributes.ToDictionary(x => x.Key, x => x.Value));
                    result.Add(new ReferenceBookItem(child, formattedTitle, categories.ToList()));
                }
                else
                {
                    BuildReferenceBookItems(child.Id, objects, categories.Union(new[] { title }).ToList(), stringFormat, result, typesToShow, attributeFormatParser);
                }
            }
        }
コード例 #2
0
        private string GetEffectiveAttributeTitle(IDataObject obj, string stringFormat)
        {
            var formattedTitle = string.IsNullOrEmpty(stringFormat)
                ? obj.DisplayName
                : _attributeFormatParser.AttributesFormat(stringFormat, obj.Attributes.ToDictionary(x => x.Key, x => x.Value));

            return(formattedTitle);
        }