/// <summary>
        /// Populates the grid container
        /// with the contents of a given directory.
        /// </summary>
        /// <param name="path">Directory path</param>
        /// <param name="row">Container to add the entries into</param>
        private void PopulateDirectoryRows(string path, GridContainer row)
        {
            string[] directories = new string[] { };

            try
            {
                // Get the directory entries

                directories = Directory.GetDirectories(path);
            }
            catch
            {
            }

            // Add each non-hidden, non-system directories into the container

            if (directories.Length > 100)
            {
                Cursor = Cursors.AppStarting;
            }

            foreach (string directory in directories)
            {
                DirectoryInfo info = new DirectoryInfo(directory);

                if ((info.Attributes & (FileAttributes.Hidden | FileAttributes.System)) == 0)
                {
                    // Allocate a new GridRow for the directory entry, with
                    // the first cell allocated and set to the directory name

                    GridRow frow = new GridRow(info.Name);

                    // Let it's row height auto-size

                    frow.RowHeight = 0;

                    // Tell the grid that the row might have nested rows
                    // under it, which we will determine if / when the user
                    // clicks on the row's expand button

                    frow.RowsUnresolved = true;

                    // Set the Tag value to the directory, so we can use it later
                    // to resolve and potentially load any discovered entries

                    frow.Tag = directory;

                    // Set the cell image to the directory icon

                    frow.Cells[0].CellStyles.Default.Image =
                        ShellServices.GetFileImage(directory, false, false);

                    // Add the row to the container

                    row.Rows.Add(frow);
                }
            }
        }
        /// <summary>
        /// Populates the given container with files from
        /// the given directory path.
        /// </summary>
        /// <param name="path">Directory path</param>
        /// <param name="row">Container to add files into</param>
        private void PopulateDirectoryFiles(string path, GridContainer row)
        {
            string[] files = new string[] { };

            try
            {
                // Get the directory files

                files = Directory.GetFiles(path);
            }
            catch
            {
            }

            // Add each non-hidden, non-system file
            // into the container

            if (files.Length > 100)
            {
                Cursor = Cursors.AppStarting;
            }

            foreach (string file in files)
            {
                FileInfo info = new FileInfo(file);

                if ((info.Attributes & (FileAttributes.Hidden | FileAttributes.System)) == 0)
                {
                    // Allocate a GridRow, with the first cell contents
                    // being allocated and set to the file's name

                    GridRow frow = new GridRow(info.Name);

                    // Let the row height auto-size

                    frow.RowHeight = 0;

                    // Save the file path for future use

                    frow.Tag = file;

                    // Set the cell image to the file icon

                    frow.Cells[0].CellStyles.Default.Image =
                        ShellServices.GetFileImage(file, false, false);

                    // Add the file to the container

                    row.Rows.Add(frow);
                }
            }
        }
        /// <summary>
        /// Populates the grid with the current
        /// discoverable system drives
        /// </summary>
        private void PopulateDriveRows()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;

            foreach (DriveInfo drive in DriveInfo.GetDrives())
            {
                if (drive.DriveType == DriveType.Fixed)
                {
                    // Allocate a new GridRow for the drive, with the
                    // first cell allocated and set to the drive name.

                    GridRow drow = new GridRow(drive.Name);

                    // Let the height auto-size

                    drow.RowHeight = 0;

                    // The RowsUnresolved property is a convenient mechanism
                    // to tell the grid that the row may have nested rows, but
                    // that fact has not yet been determined.
                    //
                    // Later, when the user clicks on the row's expand button, the
                    // application then can then resolve the row state by doing 2 things:
                    //
                    // 1 - Clear the RowsUnresolved property (as, whether there are nested
                    //     rows or not) it is now resolved.
                    //
                    // 2 - Determine whether there are in fact any nested rows or
                    //     not and load them into the grid if there are.

                    drow.RowsUnresolved = true;

                    // Save the root directory path for use later if
                    // the user clicks on the expand button

                    drow.Tag = drive.RootDirectory.FullName;

                    // Set the cell image to the drive icon

                    drow.Cells[0].CellStyles.Default.Image =
                        ShellServices.GetFileImage(drive.Name, true, false);

                    // Add the row to the panel

                    panel.Rows.Add(drow);
                }
            }
        }
        /// <summary>
        /// This routine populates the right-hand grid with
        /// files discovered from the given directory path.
        /// </summary>
        /// <param name="path">Directory path</param>
        /// <param name="row">Container row</param>
        /// <param name="count">Count of files added</param>
        /// <returns>The total size of all files added</returns>
        private long PopulateDirectoryInfo(
            string path, GridContainer row, ref int count)
        {
            string[] files = new string[] { };

            try
            {
                // Get the directory files

                files = Directory.GetFiles(path);
            }
            catch
            {
            }

            // Add each discovered, non-hidden, non-system files
            // into the given container

            long totalSize = 0;

            if (files.Length > 100)
            {
                Cursor = Cursors.AppStarting;
            }

            foreach (string file in files)
            {
                FileInfo info = new FileInfo(file);

                if ((info.Attributes & (FileAttributes.Hidden | FileAttributes.System)) == 0)
                {
                    // Create an array of
                    // cell values to create the new row with.

                    long size = info.Length;

                    object[] s = new object[5];
                    s[0] = info.Name;
                    s[1] = size;
                    s[2] = ShellServices.GetFileType(file);
                    s[3] = info.CreationTime.ToShortDateString();
                    s[4] = info.LastAccessTime.ToShortDateString();

                    // Allocate a new row, giving it an array of objects
                    // to use in the creation of the row's Cells

                    GridRow frow = new GridRow(s);

                    // Let the rowheight auto-size and set the Tag value
                    // to the file path for future use.

                    frow.RowHeight = 0;
                    frow.Tag       = file;

                    // Set the first cell's image to the file icon

                    frow.Cells[0].CellStyles.Default.Image =
                        ShellServices.GetFileImage(file, false, false);

                    // Add the row to the container, and
                    // update our running count and total size

                    row.Rows.Add(frow);

                    count++;
                    totalSize += size;
                }
            }

            Cursor = Cursors.Default;

            return(totalSize);
        }