/// <summary>
 /// For images in slideshow
 /// </summary>
 /// <param name="filePathName"></param>
 /// <param name="height"></param>
 /// <param name="width"></param>
 /// <param name="duration"></param>
 /// <param name="order"></param>
 /// <param name="inSlideShow"></param>
 public ImageData(string filePathName, int height, int width, int duration, int order, bool inSlideShow) : base(filePathName)
 {
     this.thumbNailImage = HelperMethods.BitmapImageToByte(HelperMethods.BitmapToBitmapImage(MediaPlayerLib.Properties.Resources.ImageThumbNail));
     this.height         = height;
     this.width          = width;
     this.duration       = duration;
     base.order          = order;
     if (inSlideShow)
     {
         //Update database
         MediaDataMapper mediaDataDataContent = new MediaDataMapper()
         {
             Duration       = this.Duration,
             Description    = this.Description,
             Order          = this.Order,
             FilePathName   = this.FilePathName,
             MediaDataType  = MediaDataType.Image,
             ThumbNailImage = this.ThumbNailImage
         };
         this.id = MediaDataQuery.NewMediaData(mediaDataDataContent);
     }
     else
     {
         this.id = -1;
     }
 }
        /// <summary>
        /// Load images
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void imageLoader_DoWork(object sender, DoWorkEventArgs e)
        {
            // Get entry
            MediaData mediaData = (ImageData)e.Argument;

            if (mediaData is ImageData)
            {
                try {
                    // Read image to get width and height
                    Image image = Image.FromFile(mediaData.FilePathName);
                    ((ImageData)mediaData).Width  = image.Width;
                    ((ImageData)mediaData).Height = image.Height;
                    // Create thumbnail
                    BitmapImage thumbNailImage = HelperMethods.CreateThumbNail(mediaData.FilePathName, ((ImageData)mediaData).Width, ((ImageData)mediaData).Height, 100, 100);
                    ((ImageData)mediaData).ThumbNailImage = HelperMethods.BitmapImageToByte(thumbNailImage);
                    //((ImageData)mediaData).ThumbNailImage.Freeze(); // Needs doing otherwise errors
                } catch {
                    MessageBox.Show(string.Format("Error creating thumbnail for {0}", mediaData.FileName), "Error");
                }
            }
        }
 /// <summary>
 /// For video in folder
 /// </summary>
 /// <param name="filePathName"></param>
 /// <param name="inSlideShow"></param>
 public VideoData(string filePathName, bool inSlideShow) : base(filePathName)
 {
     this.thumbNailImage = HelperMethods.BitmapImageToByte(HelperMethods.BitmapToBitmapImage(MediaPlayerLib.Properties.Resources.VideoThumbNail));
     this.id             = -1;
 }