protected virtual void WriteTopLevel(HtmlTextWriter output)
{
int indent = output.Indent;
output.Indent = indent + 2;
List<SiteNav> lstNav = GetTopNav();
SiteNav parentPageNav = GetParentPage();
List<SiteNav> lstNavTree = GetPageNavTree().OrderByDescending(x => x.NavOrder).ToList();
this.ParentFileName = parentPageNav.FileName.ToLowerInvariant();
if (lstNav != null && lstNav.Any()) {
output.WriteLine();
WriteListPrefix(output);
int indent2 = output.Indent + 1;
string sItemCSS = "";
if (!String.IsNullOrEmpty(CSSItem)) {
sItemCSS = String.Format(" {0} ", this.CSSItem);
}
string sThis1CSS = sItemCSS;
foreach (SiteNav c1 in lstNav) {
output.Indent = indent2;
List<SiteNav> cc = GetChildren(c1.Root_ContentID);
string sChild = " ";
if (this.MultiLevel) {
if (cc != null && cc.Any()) {
sChild = " level1-haschildren " + this.CSSHasChildren + " ";
}
sThis1CSS = " level1 " + sItemCSS + sChild;
} else {
sThis1CSS = sItemCSS;
}
if (SiteData.IsFilenameCurrentPage(c1.FileName) || (IsContained(lstNavTree, c1.Root_ContentID) != null) || AreFilenamesSame(c1.FileName, this.ParentFileName)) {
sThis1CSS = sThis1CSS + " " + this.CSSSelected;
}
if (lstNav.Where(x => x.NavOrder < 0).Count() > 0) {
if (c1.NavOrder < 0) {
sThis1CSS = sThis1CSS + " parent-nav";
} else {
sThis1CSS = sThis1CSS + " child-nav";
}
}
sThis1CSS = sThis1CSS.Replace(" ", " ").Replace(" ", " ").Trim();
iItemNumber++;
output.WriteLine("<li id=\"listitem" + iItemNumber.ToString() + "\" class=\"" + sThis1CSS + "\"><a href=\"" + c1.FileName + "\">" + c1.NavMenuText + "</a>");
int indent3 = output.Indent;
if (this.MultiLevel && cc != null && cc.Any()) {
LoadChildren(output, c1.Root_ContentID, sItemCSS, iItemNumber, 2);
}
output.Indent = indent3;
output.WriteLine("</li>");
output.WriteLine();
}
WriteListSuffix(output);
} else {
#if DEBUG
output.WriteLine("<span style=\"display: none;\" id=\"" + this.ClientID + "\"></span>");
#endif
}
output.Indent = indent;
}