internal void ParseFileDone(List <CNode> cNodes) { Task.Run(() => { List <ConvertNode> tempList = new List <ConvertNode>(); foreach (CNode node in cNodes) { ConvertNode tempConvertn = new ConvertNode((CNode)node.Clone()); tempConvertn.SetChildrenNodeType(tempConvertn); tempList.Add(tempConvertn); } Dictionary <string, Dictionary <string, string> > tempMap = new Dictionary <string, Dictionary <string, string> >(); foreach (CNode rootNode in tempList) { Dictionary <string, string> tempDic = new Dictionary <string, string>(); GetChildrenNodePath(rootNode, tempDic); tempMap.Add(rootNode.Name, tempDic); } this.viewDispatcher.BeginInvoke((Action)(() => { RootNodeList = tempList; OriginalNodeMap = tempMap; if (SelectedRootNode == null) { SelectedRootNode = RootNodeList.FirstOrDefault(); } if (SelectedRootNode != null) { SelectedOriginalNodeDic = OriginalNodeMap[SelectedRootNode.Name]; } })); }); }
public void ClearMemory() { BookTitle = null; BookID = 0; if (TOCNodeList != null) { TOCNodeList.Clear(); } if (RootNodeList != null) { RootNodeList.Clear(); } CurrentLevel = 1; CurrentLeafNode = null; CurrentHighlight = 1; CurrentTocID = -1; StartTocID = 0; EndTocID = 0; if (SearchTermWordList != null) { SearchTermWordList.Clear(); } if (SearchKeyWordList != null) { SearchKeyWordList.Clear(); } CurrentSearchContent = null; CurrentSearchHeader = null; }
public async void GetDlContentFromDB() { TOCNodeList = await PublicationUtil.Instance.GetDlBookTOC(BookID); RootNodeList.AddRange(TOCNodeList); UpdateTOCNodeListAndRefreshTableView(); }
public async Task GetPublicationTocFromDB() { TOCNode rootNode = await PublicationContentUtil.Instance.GetTOCByBookId(BookID); if (rootNode == null) { return; } List <TOCNode> nodelist = rootNode.ChildNodes; if (nodelist == null) { return; } if (TOCNodeList.Count > 0) { TOCNodeList.Clear(); } TOCNodeList.AddRange(nodelist); if (RootNodeList.Count > 0) { RootNodeList.Clear(); } RootNodeList.AddRange(nodelist); if (TOCNodeList.Any()) { CurrentLevel = TOCNodeList [0].NodeLevel; } if (CurrentTocID < 0) { UpdateTOCNodeList(); PanelController.RefreshTOCViewData(); CurrentLeafNode = rootNode.GetFirstPage(); StartTocID = CurrentLeafNode.ID; EndTocID = CurrentLeafNode.ID; } else { TOCNode rootTocNode = RootNodeList[0].ParentNode; TOCNode currentTocNode = PublicationContentUtil.Instance.GetTOCByTOCId(CurrentTocID, rootTocNode); GetTOCNodeListByCurrentLeafNode(currentTocNode); CurrentLeafNode = currentTocNode; StartTocID = CurrentTocID; EndTocID = CurrentTocID; PanelController.RefreshTOCViewData(); PanelController.SelectTOCRectByTocID(currentTocNode.ID); } }
public void InitializeTOCDataByBookID(int bookID, int tocID) { BookID = bookID; CurrentTocID = tocID; CurrentHighlight = 1; CurrentLeafNode = null; CurrentSearchContent = null; if (RootNodeList != null) { RootNodeList.Clear(); } if (TOCNodeList != null) { TOCNodeList.Clear(); } }
public async void GetPublicationTocFromDB() { TOCNode rootNodeList = await PublicationContentUtil.Instance.GetTOCByBookId(BookID); CurrentLeafNode = rootNodeList.GetFirstPage(); TOCNodeList = rootNodeList.ChildNodes; if (TOCNodeList != null) { RootNodeList.AddRange(TOCNodeList); } if (TOCNodeList.Any()) { CurrentLevel = TOCNodeList [0].NodeLevel; } UpdateTOCNodeListAndRefreshTableView(); PanelController.TOCController.OpenPublicationContentAtTOCNode(CurrentLeafNode); }
private void ReadMaskMetadataNInsertIntoCategoryTable(XmlDocument XmlDoc, CategoryType categoryType) { int CategoryOrder = 0; XmlNodeList RootNodeList; string DefaultCategoryLanguageValue = string.Empty; MetadataCategoryInfo MetadataInfo; string CategoryTypeText = string.Empty; // Get Mask Type like "I" for Indicator, "A" for Map and "S" for Source CategoryTypeText = this.GetCategoryTypeText(categoryType); // Get Root Element NodeList RootNodeList = XmlDoc.SelectNodes(Constants.MetadataCategory.RootElementName); // Get first recrod from "root/Input<n>" Node and insert into all available Metadata_Category language table // Check Category In each "root/Input<n>" Node foreach (XmlElement InputNodeList in RootNodeList.Item(0).ChildNodes) { CategoryOrder++; // Check category In Input Node and insert metdata category language value into all metadata category language tables for (int i = 0; i < InputNodeList.ChildNodes.Count; i++) { if (InputNodeList.ChildNodes[i].Name == Constants.MetadataCategory.CaptionElementName) { // set category value into default category langauge value DefaultCategoryLanguageValue = InputNodeList.ChildNodes[i].InnerText; // check xml languagecode is default language if (InputNodeList.ChildNodes[i].Attributes[Constants.MetadataCategory.LangAttributeName].Value.ToUpper() == this.DBQueries.LanguageCode.Replace("_", "").ToUpper()) { MetadataInfo = new MetadataCategoryInfo(); // Set MetadataCategoryInfo Value MetadataInfo.CategoryName = InputNodeList.ChildNodes[i].InnerText; MetadataInfo.CategoryType = CategoryTypeText; MetadataInfo.CategoryOrder = CategoryOrder; // Add MetadataCategory Into all metdata category language tables this.CheckNCreateMetadataCategoryForCurrentLanguageOnly(MetadataInfo); break; } } } // update metadata category language value into their respective metadata category language table for (int i = 0; i < InputNodeList.ChildNodes.Count; i++) { if (InputNodeList.ChildNodes[i].Name == Constants.MetadataCategory.CaptionElementName) { // Check lang attribute is valid language or not if (this.DBConnection.IsValidDILanguage(this.DBQueries.DataPrefix, InputNodeList.ChildNodes[i].Attributes[Constants.MetadataCategory.LangAttributeName].Value)) { MetadataInfo = new MetadataCategoryInfo(); // Set MetadataCategoryInfo Value MetadataInfo.CategoryName = InputNodeList.ChildNodes[i].InnerText; MetadataInfo.CategoryType = CategoryTypeText; MetadataInfo.CategoryOrder = CategoryOrder; if (MetadataInfo.CategoryName != DefaultCategoryLanguageValue) { // update MetadataCategory Into database this.CheckNUpdateMetadataCategoryInLangTable(MetadataInfo, "_" + InputNodeList.ChildNodes[i].Attributes[Constants.MetadataCategory.LangAttributeName].Value, DefaultCategoryLanguageValue); } } } } } }