mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-25 19:48:04 +00:00
Compare commits
2 Commits
14a5bea926
...
copilot/fi
Author | SHA1 | Date | |
---|---|---|---|
![]() |
19bba7f229 | ||
![]() |
7a05793bf7 |
Submodule QuickLook.Common updated: 21cbdf4cfe...8978dce92c
@@ -81,7 +81,8 @@ public class BackgroundVisualHost : FrameworkElement
|
|||||||
private readonly CreateContentFunction _createContent;
|
private readonly CreateContentFunction _createContent;
|
||||||
private readonly Action _invalidateMeasure;
|
private readonly Action _invalidateMeasure;
|
||||||
|
|
||||||
private readonly AutoResetEvent _sync = new(false);
|
private readonly AutoResetEvent _sync =
|
||||||
|
new AutoResetEvent(false);
|
||||||
|
|
||||||
public ThreadedVisualHelper(
|
public ThreadedVisualHelper(
|
||||||
CreateContentFunction createContent,
|
CreateContentFunction createContent,
|
||||||
@@ -124,9 +125,15 @@ public class BackgroundVisualHost : FrameworkElement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Private Fields
|
||||||
|
|
||||||
public ThreadedVisualHelper ThreadedHelper;
|
public ThreadedVisualHelper ThreadedHelper;
|
||||||
private HostVisual _hostVisual;
|
private HostVisual _hostVisual;
|
||||||
|
|
||||||
|
#endregion Private Fields
|
||||||
|
|
||||||
|
#region IsContentShowingProperty
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifies the IsContentShowing dependency property.
|
/// Identifies the IsContentShowing dependency property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -156,6 +163,10 @@ public class BackgroundVisualHost : FrameworkElement
|
|||||||
bvh.HideContentHelper();
|
bvh.HideContentHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion IsContentShowingProperty
|
||||||
|
|
||||||
|
#region CreateContent Property
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifies the CreateContent dependency property.
|
/// Identifies the CreateContent dependency property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -185,4 +196,6 @@ public class BackgroundVisualHost : FrameworkElement
|
|||||||
bvh.CreateContentHelper();
|
bvh.CreateContentHelper();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion CreateContent Property
|
||||||
}
|
}
|
||||||
|
@@ -58,16 +58,50 @@ public partial class InfoPanel : UserControl
|
|||||||
Dispatcher.BeginInvoke(new Action(() => image.Source = source));
|
Dispatcher.BeginInvoke(new Action(() => image.Source = source));
|
||||||
});
|
});
|
||||||
|
|
||||||
var name = Path.GetFileName(path);
|
string name;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
name = Path.GetFileName(path);
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
// Handle invalid path characters gracefully
|
||||||
|
name = path;
|
||||||
|
}
|
||||||
|
catch (PathTooLongException)
|
||||||
|
{
|
||||||
|
// Handle path too long scenarios
|
||||||
|
name = path;
|
||||||
|
}
|
||||||
filename.Text = string.IsNullOrEmpty(name) ? path : name;
|
filename.Text = string.IsNullOrEmpty(name) ? path : name;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
var last = File.GetLastWriteTime(path);
|
var last = File.GetLastWriteTime(path);
|
||||||
modDate.Text = string.Format(TranslationHelper.Get("InfoPanel_LastModified"),
|
modDate.Text = string.Format(TranslationHelper.Get("InfoPanel_LastModified"),
|
||||||
last.ToString(CultureInfo.CurrentCulture));
|
last.ToString(CultureInfo.CurrentCulture));
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
// Handle invalid path characters gracefully
|
||||||
|
modDate.Text = TranslationHelper.Get("InfoPanel_LastModified_Unavailable") ?? "Last modified: Unavailable";
|
||||||
|
}
|
||||||
|
catch (UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
// Handle access denied scenarios
|
||||||
|
modDate.Text = TranslationHelper.Get("InfoPanel_LastModified_Unavailable") ?? "Last modified: Unavailable";
|
||||||
|
}
|
||||||
|
catch (PathTooLongException)
|
||||||
|
{
|
||||||
|
// Handle path too long scenarios
|
||||||
|
modDate.Text = TranslationHelper.Get("InfoPanel_LastModified_Unavailable") ?? "Last modified: Unavailable";
|
||||||
|
}
|
||||||
|
|
||||||
Stop = false;
|
Stop = false;
|
||||||
|
|
||||||
_ = Task.Run(() =>
|
_ = Task.Run(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
@@ -117,6 +151,22 @@ public partial class InfoPanel : UserControl
|
|||||||
$"{totalSizeL.ToPrettySize(2)} {t}";
|
$"{totalSizeL.ToPrettySize(2)} {t}";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
// Handle invalid path characters gracefully
|
||||||
|
Dispatcher.Invoke(() => { totalSize.Text = "Size: Unavailable"; });
|
||||||
|
}
|
||||||
|
catch (UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
// Handle access denied scenarios
|
||||||
|
Dispatcher.Invoke(() => { totalSize.Text = "Size: Unavailable"; });
|
||||||
|
}
|
||||||
|
catch (PathTooLongException)
|
||||||
|
{
|
||||||
|
// Handle path too long scenarios
|
||||||
|
Dispatcher.Invoke(() => { totalSize.Text = "Size: Unavailable"; });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user