Skip to content

Commit e61151d

Browse files
committed
Improve preview panel performance
1 parent 4cd0891 commit e61151d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
HorizontalAlignment="Right"
118118
VerticalAlignment="Top"
119119
Style="{DynamicResource PreviewItemSubTitleStyle}"
120-
Text="{Binding FileSize, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}"
120+
Text="{Binding FileSize, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Mode=OneWay}"
121121
TextWrapping="Wrap"
122122
Visibility="{Binding FileSizeVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
123123

Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
2020
private static readonly string ClassName = nameof(PreviewPanel);
2121

2222
private string FilePath { get; }
23-
public string FileSize { get; } = "";
23+
public string FileSize { get; private set; } = Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
2424
public string CreatedAt { get; } = "";
2525
public string LastModifiedAt { get; } = "";
2626
private ImageSource _previewImage = new BitmapImage();
@@ -63,7 +63,18 @@ public PreviewPanel(Settings settings, string filePath, ResultType type)
6363

6464
if (Settings.ShowFileSizeInPreviewPanel)
6565
{
66-
FileSize = type == ResultType.File ? GetFileSize(filePath) : GetFolderSize(filePath);
66+
if (type == ResultType.File)
67+
{
68+
FileSize = GetFileSize(filePath);
69+
}
70+
else
71+
{
72+
_ = Task.Run(() =>
73+
{
74+
FileSize = GetFolderSize(filePath);
75+
OnPropertyChanged(nameof(FileSize));
76+
}).ConfigureAwait(false);
77+
}
6778
}
6879

6980
if (Settings.ShowCreatedDateInPreviewPanel)

0 commit comments

Comments
 (0)