async Task GetTabDetails() { await Task.Factory.StartNew(() => { IEnumerable <XNode> nodes = from p in xdoc.Descendants("PageConfiguration") from p1 in p.Descendants("ReportMapping") from p2 in p1.Nodes() select p2; foreach (XNode node in nodes) { if (node is XElement) { var tabName = ((XElement)node).Attribute("HeaderTabTitle") != null ? ((XElement)node).Attribute("HeaderTabTitle").Value : ""; WorkbookTab tab = null; if (!string.IsNullOrEmpty(tabName) && !workbookDetails.IsTabExists(tabName)) { //Get the Tab Details. tab = new WorkbookTab(tabName); workbookDetails.Tabs.Add(tab); } else { tab = workbookDetails.Tabs.Find(x => x.TabName == tabName); } //Now get the subtab details. GetSubTabDetail(node, tab); } } }); }
void GetSubTabDetail(XNode node, WorkbookTab tab) { var subTabName = ((XElement)node).Attribute("HeaderSubTabTitle") != null ? ((XElement)node).Attribute("HeaderSubTabTitle").Value : ""; if (!string.IsNullOrEmpty(subTabName) && !tab.IsSubTabExists(subTabName)) { //Get the SubTab Details. WorkbookSubTab subTab = new WorkbookSubTab(subTabName); tab.SubTabDetails.Add(subTab); //Get the preference Detail GetSubTabPreferenceDetail(node, subTab); } }