public void ReLoadDictionary() { dictionaryTreeView.Nodes.Clear(); LanguageData dataLayer = new LanguageData(); dsLanguageData.DictionaryDataTable dictionary = dataLayer.daDictionary.GetData(); foreach (dsLanguageData.DictionaryRow dict in dictionary) { MyTreeNode tmpDict = new MyTreeNode(dict.Name, dict.ID, MyTreeNodeType.Dictionary); foreach (char letter in dict.Alphabet) { MyTreeNode tmpLet = new MyTreeNode(letter.ToString(), -1, MyTreeNodeType.Letter); dsLanguageData.CardDataTable cards = dataLayer.GetCardsBeginningWith(letter.ToString(), dict.Column); foreach (dsLanguageData.CardRow card in cards) { tmpLet.Nodes.Add(new MyTreeNode((string)card[dict.Column], card.ID, MyTreeNodeType.Card)); } tmpDict.Nodes.Add(tmpLet); } dictionaryTreeView.Nodes.Add(tmpDict); } }
public void ReLoadCardLists() { cardListsTreeView.Nodes.Clear(); try { LanguageData dataLayer = new LanguageData(); foreach (dsLanguageData.CollectionRow collection in dataLayer.daCollection.GetData()) { MyTreeNode collectionNode = new MyTreeNode(collection.Name, collection.ID, MyTreeNodeType.Collection); foreach (dsLanguageData.CardListRow cardList in dataLayer.daCardList.GetDataByCollectionID(collection.ID)) { collectionNode.Nodes.Add(new MyTreeNode(cardList.Name, cardList.ID, MyTreeNodeType.CardList)); } cardListsTreeView.Nodes.Add(collectionNode); } } catch (Exception e) { MessageBox.Show(e.Message); } }