mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-17 13:52:40 +00:00
Finish ImageViewer; mouse drag to scroll
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Windows.Controls;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace QuickLook.Plugin.LastResort
|
||||
{
|
||||
@@ -7,9 +9,57 @@ namespace QuickLook.Plugin.LastResort
|
||||
/// </summary>
|
||||
public partial class InfoPanel : UserControl
|
||||
{
|
||||
private bool _stop;
|
||||
|
||||
public InfoPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool Stop
|
||||
{
|
||||
set => _stop = value;
|
||||
get => _stop;
|
||||
}
|
||||
|
||||
public void DisplayInfo(string path)
|
||||
{
|
||||
var icon = IconHelper.GetBitmapFromPath(path, IconHelper.IconSizeEnum.ExtraLargeIcon).ToBitmapSource();
|
||||
|
||||
image.Source = icon;
|
||||
|
||||
var name = Path.GetFileName(path);
|
||||
filename.Content = string.IsNullOrEmpty(name) ? path : name;
|
||||
|
||||
var last = File.GetLastWriteTime(path);
|
||||
modDate.Content = $"{last.ToLongDateString()} {last.ToLongTimeString()}";
|
||||
|
||||
Stop = false;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var size = new FileInfo(path).Length;
|
||||
|
||||
Dispatcher.Invoke(() => { totalSize.Content = size.ToPrettySize(2); });
|
||||
}
|
||||
else if (Directory.Exists(path))
|
||||
{
|
||||
long totalDirsL;
|
||||
long totalFilesL;
|
||||
long totalSizeL;
|
||||
|
||||
FileHelper.CountFolder(path, ref _stop, out totalDirsL, out totalFilesL, out totalSizeL);
|
||||
|
||||
if (!Stop)
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
totalSize.Content =
|
||||
$"{totalSizeL.ToPrettySize(2)} ({totalDirsL} folders and {totalFilesL} files)";
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user