/// <summary>
 /// An event that is raised by the VisualFileBrowser control when a user selects a directory from the list.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">A VisualFileBrowser.FileOrDirectorySelectedEventArgs class instance.</param>
 private void vfbSelectFileOrDir_DirectorySelected(object sender, VPKSoft.VisualFileBrowser.VisualFileBrowser.FileOrDirectorySelectedEventArgs e)
 {
     if (SelectFile)                      // if files are instructed to be selected..
     {
         return;                          // .. ignore the event.
     }
     selectedDirectory = e.Path;          // Assign the selected directory..
     DialogResult      = DialogResult.OK; // .. and return with an OK value from this dialog.
 }
        /// <summary>
        /// An event that is raised by the VisualFileBrowser control when a custom image describing an item in the list.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">A VisualFileBrowser.FileOrDirectorySelectedEventArgs class instance.</param>
        private void vfbSelectFileOrDir_GetCustomItemImage(object sender, VPKSoft.VisualFileBrowser.VisualFileBrowser.FileOrDirectorySelectedEventArgs e)
        {
            if (e.IsFile)                 // if a custom image for a file is requested..
            {
                Database.SetFile(e.Path); // first ensure the file is added to the database..

                // Get statistics for the file from the database..
                VideoFileStatistic statistic = Database.GetStatistic(e.Path);
                if (statistic.Played) // A video file is watched so give an image which indicates a tick or check..
                {
                    e.Image = Properties.Resources.tick;
                }
                else if (statistic.Position > 0) // A part of the video file is watched so give it an image of a quarter of a ball..
                {
                    e.Image = Properties.Resources.not_whole;
                }
                else // no reasonable images to give so give it nothing..
                {
                    e.Image = null;
                }
            }
        }