Пример #1
0
        /// <summary>
        /// Populates the <see cref="ListView"/> of this control with the contents of a directory.
        /// </summary>
        /// <param name="directory">The directory which contents will be listed in the listview.</param>
        private void PopulateListView(OutputDirectoryInfo directory)
        {
            int index = 0;

            if (directory != null)
            {
                foreach (var subDirectory in directory.SubDirectories)
                {
                    this.PopulateListViewItem(this.GetNextListViewItem(index++), subDirectory);
                }

                foreach (var file in directory.Files)
                {
                    this.PopulateListViewItem(this.GetNextListViewItem(index++), file);
                }

                foreach (var shortcut in directory.Shortcuts)
                {
                    this.PopulateListViewItem(this.GetNextListViewItem(index++), shortcut);
                }
            }

            while (index < this.listView1.Items.Count)
            {
                this.listView1.Items.RemoveAt(index);
            }

            this.listView1.SelectedItems.Clear();
        }
Пример #2
0
        /// <summary>
        /// Creates a new <see cref="ListViewItem"/> and populates it with directory information.
        /// </summary>
        /// <param name="subDirectory">The directory to add to the listview.</param>
        private void PopulateListViewItem(OutputDirectoryInfo subDirectory)
        {
            var lvi = new ListViewItem();

            this.PopulateListViewItem(lvi, subDirectory);

            this.listView1.Items.Add(lvi);
        }
Пример #3
0
        /// <summary>
        /// Populates a <see cref="ListViewItem"/> with information from <see cref="subDirectory"/>.
        /// </summary>
        /// <param name="lvi">The listview item to fill with data.</param>
        /// <param name="subDirectory">The directory information.</param>
        private void PopulateListViewItem(ListViewItem lvi, OutputDirectoryInfo subDirectory)
        {
            lvi.Tag = subDirectory;

            lvi.ImageIndex = 0;

            int i = 0;

            this.PopulateListViewItem(lvi, i++, subDirectory.Name);
            this.PopulateListViewItem(lvi, i++);
        }
Пример #4
0
        /// <summary>
        /// Populates a <see cref="TreeNode"/> with the contents of a <see cref="OutputDirectoryInfo"/>.
        /// </summary>
        /// <param name="treeNode">The <see cref="TreeNode"/> on which to add the contents of the directory.</param>
        /// <param name="directoryInfo">The directory contents to add to the tree node.</param>
        /// <remarks>
        ///     <para>
        ///         This method will set the <see cref="TreeNode.Tag"/> property to <paramref name="directoryInfo"/>.
        ///     </para>
        ///     <para>
        ///         This method will be called recursivly for each sub directory in <paramref name="directoryInfo"/>, creating
        ///         a sub node on <paramref name="treeNode"/>, creating a folder structure in the tree view.
        ///     </para>
        /// </remarks>
        private void PopulateTree(TreeNode treeNode, OutputDirectoryInfo directoryInfo)
        {
            treeNode.Tag = directoryInfo;

            foreach (var subDirectory in directoryInfo.SubDirectories)
            {
                var subNode = treeNode.Nodes.Add(subDirectory.Name);

                subNode.ImageIndex         = 2;
                subNode.SelectedImageIndex = 2;

                this.PopulateTree(subNode, subDirectory);
            }
        }
Пример #5
0
        /// <summary>
        /// Populates a <see cref="TreeNode"/> with the contents of a <see cref="OutputDirectoryInfo"/>.
        /// </summary>
        /// <param name="treeNode">The <see cref="TreeNode"/> on which to add the contents of the directory.</param>
        /// <param name="directoryInfo">The directory contents to add to the tree node.</param>
        /// <remarks>
        ///     <para>
        ///         This method will set the <see cref="TreeNode.Tag"/> property to <paramref name="directoryInfo"/>.
        ///     </para>
        ///     <para>
        ///         This method will be called recursivly for each sub directory in <paramref name="directoryInfo"/>, creating
        ///         a sub node on <paramref name="treeNode"/>, creating a folder structure in the tree view.
        ///     </para>
        /// </remarks>
        private void PopulateTree(TreeNode treeNode, OutputDirectoryInfo directoryInfo)
        {
            treeNode.Tag = directoryInfo;

            foreach (var subDirectory in directoryInfo.SubDirectories)
            {
                var subNode = treeNode.Nodes.Add(subDirectory.Name);

                subNode.ImageIndex = 2;
                subNode.SelectedImageIndex = 2;

                this.PopulateTree(subNode, subDirectory);
            }
        }
Пример #6
0
        /// <summary>
        /// Populates a <see cref="ListViewItem"/> with information from <see cref="subDirectory"/>.
        /// </summary>
        /// <param name="lvi">The listview item to fill with data.</param>
        /// <param name="subDirectory">The directory information.</param>
        private void PopulateListViewItem(ListViewItem lvi, OutputDirectoryInfo subDirectory)
        {
            lvi.Tag = subDirectory;

            lvi.ImageIndex = 0;

            int i = 0;
            this.PopulateListViewItem(lvi, i++, subDirectory.Name);
            this.PopulateListViewItem(lvi, i++);
        }
Пример #7
0
        /// <summary>
        /// Creates a new <see cref="ListViewItem"/> and populates it with directory information.
        /// </summary>
        /// <param name="subDirectory">The directory to add to the listview.</param>
        private void PopulateListViewItem(OutputDirectoryInfo subDirectory)
        {
            var lvi = new ListViewItem();

            this.PopulateListViewItem(lvi, subDirectory);

            this.listView1.Items.Add(lvi);
        }
Пример #8
0
        /// <summary>
        /// Populates the <see cref="ListView"/> of this control with the contents of a directory.
        /// </summary>
        /// <param name="directory">The directory which contents will be listed in the listview.</param>
        private void PopulateListView(OutputDirectoryInfo directory)
        {
            int index = 0;

            if (directory != null)
            {
                foreach (var subDirectory in directory.SubDirectories)
                {
                    this.PopulateListViewItem(this.GetNextListViewItem(index++), subDirectory);
                }

                foreach (var file in directory.Files)
                {
                    this.PopulateListViewItem(this.GetNextListViewItem(index++), file);
                }

                foreach (var shortcut in directory.Shortcuts)
                {
                    this.PopulateListViewItem(this.GetNextListViewItem(index++), shortcut);
                }
            }

            while (index < this.listView1.Items.Count)
            {
                this.listView1.Items.RemoveAt(index);
            }

            this.listView1.SelectedItems.Clear();
        }