Beispiel #1
0
        /// <summary>
        /// 初始化TreeView控件
        /// </summary>
        private void InitTreeView()
        {
            tvMovies.BeginUpdate();
            tvMovies.Nodes.Clear();

            TreeNode movieNode = null;

            foreach (Movie m in MovieDAL.GetAllMovies())
            {
                movieNode = new TreeNode(m.MovieName);
                tvMovies.Nodes.Add(movieNode);

                foreach (Schedule s in ScheduleDAL.GetSchedulesByMovieID(m.MovieID))
                {
                    TreeNode timeNode = new TreeNode(s.DateTime);
                    timeNode.Name = s.ScheduleID.ToString();
                    movieNode.Nodes.Add(timeNode);
                }
            }
            tvMovies.EndUpdate();
        }