Ejemplo n.º 1
0
        public override void PreloadContent()
        {
            // If the values returned are nonsensical, retry 3 times until
            // correct values are found.

            /*
             * for (int tries = 0; tries < 4; tries++)
             * {
             *  if (_videoResolutionHeight != 0 && _videoResolutionWidth >= -100000 &&
             *      _videoResolutionHeight >= -100000 && _videoResolutionWidth <= 100000 &&
             *      _videoResolutionHeight <= 100000) continue;
             *  if ((_videoResolutionHeight == 0 ||
             *       _videoResolutionWidth < -100000 || _videoResolutionHeight < -100000 ||
             *       _videoResolutionWidth > 100000 || _videoResolutionHeight > 100000) &&
             *      tries == 3)
             *  {
             *      _videoResolutionHeight = 0;
             *      _videoResolutionWidth = 0;
             *      break;
             *  }
             *
             *  GetMetaData();
             * }*/

            _thumbnailSource = FlyWeightPointer.LoadThumbnail(FilePath);
        }
Ejemplo n.º 2
0
        public string GetDirectorySize()
        {
            DirectoryInfo di  = new DirectoryInfo(_folderPath);
            string        top =
                FlyWeightPointer.SizeSuffix(di.EnumerateFiles("*", SearchOption.TopDirectoryOnly).Sum(fi => fi.Length));
            string all =
                FlyWeightPointer.SizeSuffix(di.EnumerateFiles("*", SearchOption.AllDirectories).Sum(fi => fi.Length));

            return(top + " (" + all + ")");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads the file and sets its source to this object,
        /// as long as it remains preloaded.
        /// </summary>
        /// <param name="myImageFile">The file path.</param>
        /// <returns>The completed image.</returns>
        private BitmapImage LoadImage(string myImageFile)
        {
            BitmapImage image = FlyWeightPointer.LoadImageFullRes(FileExtension, myImageFile);

            // If the image has been loaded before, it won't have to
            // get the metadata of the image again.
            if (_imageHeight != 0 || _imageWidth != 0)
            {
                return(image);
            }

            _imageHeight = image.PixelHeight;
            _imageWidth  = image.PixelWidth;
            return(image);
        }
Ejemplo n.º 4
0
 public override void PreloadContent()
 {
     _thumbnailSource = FlyWeightPointer.LoadImage(FileExtension, FilePath);
 }
Ejemplo n.º 5
0
 public string GetFileSize(string path)
 {
     return(FlyWeightPointer.SizeSuffix(new FileInfo(path).Length));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Allows certain files to be preloaded.
 /// </summary>
 public virtual void PreloadContent()
 {
     _thumbnailSource = FlyWeightPointer.LoadThumbnail(FilePath);
 }