// When the user enters a listbox item, show the image
        private void Row_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (!(sender is DataGridRow dgr))
            {
                return;
            }
            if (dgr?.Item == null)
            {
                return;
            }

            Tuple <string, string, bool> tuple = (Tuple <string, string, bool>)dgr.Item;
            string path  = Path.Combine(this.FolderPath, tuple.Item1);
            Image  image = new Image()
            {
                Source = Util.FilesFolders.GetFileTypeByItsExtension(path) == FileExtensionEnum.IsImage
                ? BitmapUtilities.GetBitmapFromImageFile(path, Constant.ImageValues.PreviewWidth480, ImageDisplayIntentEnum.Ephemeral, ImageDimensionEnum.UseWidth, out _)
                : BitmapUtilities.GetBitmapFromVideoFile(path, Constant.ImageValues.PreviewWidth480, ImageDisplayIntentEnum.Ephemeral, ImageDimensionEnum.UseWidth, out _),
                HorizontalAlignment = HorizontalAlignment.Left
            };

            dgr.ToolTip = image;
        }
Esempio n. 2
0
 /// <summary>
 //// Load: Full form
 /// Get a bitmap of the desired width. If its not there or something is wrong it will return a placeholder bitmap displaying the 'error'.
 /// Also sets a flag (isCorruptOrMissing) indicating if the bitmap wasn't retrieved (signalling a placeholder bitmap was returned)
 /// </summary>
 public virtual BitmapSource LoadBitmap(string rootFolderPath, Nullable <int> desiredWidthOrHeight, ImageDisplayIntentEnum displayIntent, ImageDimensionEnum imageDimension, out bool isCorruptOrMissing)
 {
     // Invoke the static version. The only change is that we get the full file path and pass that as a parameter
     return(BitmapUtilities.GetBitmapFromImageFile(this.GetFilePath(rootFolderPath), desiredWidthOrHeight, displayIntent, imageDimension, out isCorruptOrMissing));
 }