public Results(VideoManager videoManager) { InitializeComponent(); chkMarkAsViewed.Checked = Properties.Settings.Default.MoveToViewed; _sections = new MovieSectionNodes[Enum.GetNames(typeof(Video.MovieSection)).Length]; int index = 0; _context.MenuItems.Add(_rightClickMenu); _videoManager = videoManager; foreach (Video.MovieSection section in (Video.MovieSection[])Enum.GetValues(typeof(Video.MovieSection))) { MovieSectionNodes node = new MovieSectionNodes(); string sectionAsString = section.ToString(); node.parent = new TreeNode(); node.parent.Text = sectionAsString; node.parent.Name = sectionAsString; node.viewed = new TreeNode(); node.viewed.Text = "Viewed"; node.viewed.Name = sectionAsString + node.viewed.Text; node.unviewed = new TreeNode(); node.unviewed.Text = "Unviewed"; node.unviewed.Name = sectionAsString + node.unviewed.Text; node.parent.Nodes.Add(node.viewed); node.parent.Nodes.Add(node.unviewed); _sections[index] = node; index++; } // Add the nodes to the Treeview control TreeNode root = new TreeNode(); root.Text = "Late Shift"; root.Name = "Late Shift"; treeView1.Nodes.Add(root); for (int i = 0; i < index; i++) { root.Nodes.Add(_sections[i].parent); } AddVideos(); }
private void AddVideos() { List <Video> videos = _videoManager.Videos; foreach (Video video in videos) { VideoNode node = new VideoNode(video); // Now where does it go? MovieSectionNodes parentNode = _sections[(int)video.VideoSection]; if (video.Watched) { parentNode.viewed.Nodes.Add(node); } else { parentNode.unviewed.Nodes.Add(node); } } }