//adds the nodes to the tree and fills the objects in private void prepareTree() { treeMain.Nodes[0].Nodes.Clear(); List <InterpretDTO> interprets = new List <InterpretDTO>(); List <String> albums = new List <string>(); FunctionController fc = new FunctionController(); interprets = fc.getAllInterprets(); foreach (InterpretDTO i in interprets) { string interpretName = i.getName(); string letter = interpretName.Substring(0, 1); if (!(treeMain.Nodes[0].Nodes.ContainsKey(letter))) { treeMain.Nodes[0].Nodes.Add(letter.ToUpper(), letter.ToUpper()); } TreeNode[] currentNode = treeMain.Nodes[0].Nodes.Find(letter, true); currentNode[0].Nodes.Add(interpretName, interpretName); albums = fc.getAlbumsByInterpret(interpretName); currentNode = treeMain.Nodes.Find(interpretName, true); foreach (String a in albums) { currentNode[0].Nodes.Add(a); } } treeMain.Nodes[0].Expand(); }
//Loads interpreters and genres into their comboboxes. Also prepares some form components. private void AlbumWizzard_Load(object sender, EventArgs e) { FunctionController fc = new FunctionController(); List <InterpretDTO> interprets = fc.getAllInterprets(); foreach (InterpretDTO i in interprets) { cbInterprets.Items.Add(i.getName()); } List <GenreDTO> genres = fc.getAllGenres(); foreach (GenreDTO g in genres) { cbGenres.Items.Add(g.getName()); } pictureBox1.BorderStyle = BorderStyle.FixedSingle; }