mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve preview panel performance
This commit is contained in:
parent
4cd08917cf
commit
e61151dc43
2 changed files with 14 additions and 3 deletions
|
|
@ -117,7 +117,7 @@
|
|||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{Binding FileSize, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}"
|
||||
Text="{Binding FileSize, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Mode=OneWay}"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="{Binding FileSizeVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
private static readonly string ClassName = nameof(PreviewPanel);
|
||||
|
||||
private string FilePath { get; }
|
||||
public string FileSize { get; } = "";
|
||||
public string FileSize { get; private set; } = Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
public string CreatedAt { get; } = "";
|
||||
public string LastModifiedAt { get; } = "";
|
||||
private ImageSource _previewImage = new BitmapImage();
|
||||
|
|
@ -63,7 +63,18 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
|
||||
if (Settings.ShowFileSizeInPreviewPanel)
|
||||
{
|
||||
FileSize = type == ResultType.File ? GetFileSize(filePath) : GetFolderSize(filePath);
|
||||
if (type == ResultType.File)
|
||||
{
|
||||
FileSize = GetFileSize(filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
FileSize = GetFolderSize(filePath);
|
||||
OnPropertyChanged(nameof(FileSize));
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.ShowCreatedDateInPreviewPanel)
|
||||
|
|
|
|||
Loading…
Reference in a new issue