Example #1
0
        public static void AppendNamespacesOld(this IBreadcrumbItem breadcrumb, ApiServices context, DocumentedNamespace @namespace, bool link)
        {
            var owner    = CreateNamespace(context, @namespace, link);
            var dropdown = new BreadcrumbDropdown(owner);
            var parts    = @namespace.Identity.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);

            for (int index = 0; index < parts.Length - 1; index++)
            {
                var temp = string.Join(".", parts.Take(index + 1));
                var documentedNamespace = context.ModelResolver.FindNamespace(temp);
                if (documentedNamespace != null)
                {
                    dropdown.AppendNamespace(context, documentedNamespace, true);
                }
            }
            if (link)
            {
                dropdown.Append(owner);
            }

            if (dropdown.Count > 1)
            {
                breadcrumb.Append(dropdown);
            }
            else
            {
                breadcrumb.Append(owner);
            }
        }
        public static void AppendNamespacesOld(this IBreadcrumbItem breadcrumb, ApiServices context, DocumentedNamespace @namespace, bool link)
        {
            var owner = CreateNamespace(context, @namespace, link);
            var dropdown = new BreadcrumbDropdown(owner);
            var parts = @namespace.Identity.Split(new[] {'.'}, StringSplitOptions.RemoveEmptyEntries);
            for (int index = 0; index < parts.Length - 1; index++)
            {
                var temp = string.Join(".", parts.Take(index + 1));
                var documentedNamespace = context.ModelResolver.FindNamespace(temp);
                if (documentedNamespace != null)
                {
                    dropdown.AppendNamespace(context, documentedNamespace, true);
                }
            }
            if (link)
            {
                dropdown.Append(owner);
            }

            if (dropdown.Count > 1)
            {
                breadcrumb.Append(dropdown);
            }
            else
            {
                breadcrumb.Append(owner);
            }
        }
Example #3
0
        public static void AppendNamespaces(this IBreadcrumbItem breadcrumb, ApiServices context, DocumentedNamespace @namespace, bool link)
        {
            var current = CreateNamespace(context, @namespace, link);

            var parentNamespaces = new List <DocumentedNamespace>();
            var parent           = @namespace.Tree.Parent;

            while (parent != null)
            {
                parentNamespaces.Add(parent.Namespace);
                parent = parent.Parent;
            }

            if (!link)
            {
                if (parentNamespaces.Count == 1)
                {
                    // Add the item in the drop down as an item.
                    breadcrumb.AppendNamespace(context, parentNamespaces[0], true);
                    // Append the current namespace.
                    breadcrumb.Append(current);
                }
                else if (parentNamespaces.Count > 1)
                {
                    // Create a dropdown with the first parent namespace as the owner.
                    var dropdown = new BreadcrumbDropdown(CreateNamespace(context, parentNamespaces[0], true));
                    foreach (var parentNamespace in parentNamespaces)
                    {
                        dropdown.AppendNamespace(context, parentNamespace, true);
                    }
                    // Append the dropdown.
                    breadcrumb.Append(dropdown);
                    // Append the current namespace.
                    breadcrumb.Append(current);
                }
                else
                {
                    // No parents. Just show the current namespace.
                    breadcrumb.Append(current);
                }
            }
            else
            {
                if (parentNamespaces.Count >= 1)
                {
                    // Create a dropdown with the current namespace as the owner.
                    var dropdown = new BreadcrumbDropdown(current);
                    dropdown.Append(current);
                    foreach (var parentNamespace in parentNamespaces)
                    {
                        dropdown.AppendNamespace(context, parentNamespace, true);
                    }
                    // Append the dropdown.
                    breadcrumb.Append(dropdown);
                }
                else
                {
                    // No parents. Just show the current namespace.
                    breadcrumb.Append(current);
                }
            }
        }
        public static void AppendNamespaces(this IBreadcrumbItem breadcrumb, ApiServices context, DocumentedNamespace @namespace, bool link)
        {
            var current = CreateNamespace(context, @namespace, link);

            var parentNamespaces = new List<DocumentedNamespace>();
            var parent = @namespace.Tree.Parent;
            while (parent != null)
            {
                parentNamespaces.Add(parent.Namespace);
                parent = parent.Parent;
            }

            if (!link)
            {
                if (parentNamespaces.Count == 1)
                {
                    // Add the item in the drop down as an item.
                    breadcrumb.AppendNamespace(context, parentNamespaces[0], true);
                    // Append the current namespace.
                    breadcrumb.Append(current);
                }
                else if(parentNamespaces.Count > 1)
                {
                    // Create a dropdown with the first parent namespace as the owner.
                    var dropdown = new BreadcrumbDropdown(CreateNamespace(context, parentNamespaces[0], true));
                    foreach (var parentNamespace in parentNamespaces)
                    {
                        dropdown.AppendNamespace(context, parentNamespace, true);
                    }
                    // Append the dropdown.
                    breadcrumb.Append(dropdown);
                    // Append the current namespace.
                    breadcrumb.Append(current);
                }
                else
                {
                    // No parents. Just show the current namespace.
                    breadcrumb.Append(current);
                }
            }
            else
            {
                if (parentNamespaces.Count >= 1)
                {
                    // Create a dropdown with the current namespace as the owner.
                    var dropdown = new BreadcrumbDropdown(current);
                    dropdown.Append(current);
                    foreach (var parentNamespace in parentNamespaces)
                    {
                        dropdown.AppendNamespace(context, parentNamespace, true);
                    }
                    // Append the dropdown.
                    breadcrumb.Append(dropdown);
                }
                else
                {
                    // No parents. Just show the current namespace.
                    breadcrumb.Append(current);
                }
            }
        }