mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- Add style for hiding when non-filesize
- Add Strings
This commit is contained in:
parent
dcf72bca5b
commit
588e814e50
3 changed files with 89 additions and 17 deletions
|
|
@ -413,4 +413,8 @@
|
|||
<system:String x:Key="RecommendAcronyms">sn</system:String>
|
||||
<system:String x:Key="RecommendAcronymsDesc">Sticky Notes</system:String>
|
||||
|
||||
<!-- Preview Area -->
|
||||
<system:String x:Key="FileSize">File Size</system:String>
|
||||
<system:String x:Key="Created">Created</system:String>
|
||||
<system:String x:Key="LastModified">Last Modified</system:String>
|
||||
</ResourceDictionary>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
|
||||
Name="FlowMainWindow"
|
||||
|
|
@ -490,17 +491,81 @@
|
|||
x:Name="PreviewSubTitle"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{Binding Result.SubTitle}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="FileSize" />
|
||||
<TextBlock Style="{DynamicResource PreviewItemSubTitleStyle}" Text="{Binding Result.FileSize}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Created" />
|
||||
<TextBlock Style="{DynamicResource PreviewItemSubTitleStyle}" Text="{Binding Result.FileCreated}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Last Modified" />
|
||||
<TextBlock Style="{DynamicResource PreviewItemSubTitleStyle}" Text="{Binding Result.LastModifed}" />
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="{x:Type StackPanel}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=SizeValue, UpdateSourceTrigger=PropertyChanged, Path=Text}" Value="{x:Static sys:String.Empty}">
|
||||
<Setter Property="Height" Value="0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<Separator Margin="0,0,0,0" Style="{DynamicResource PreviewSep}" />
|
||||
<Grid Margin="0,10,0,0" VerticalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="0"
|
||||
VerticalAlignment="Top"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{DynamicResource FileSize}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock
|
||||
Name="SizeValue"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{Binding Result.FileSize}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0"
|
||||
VerticalAlignment="Top"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{DynamicResource Created}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{Binding Result.FileCreated}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="0"
|
||||
VerticalAlignment="Top"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{DynamicResource LastModified}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{Binding Result.LastModifed}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Flow.Launcher.Plugin.Explorer.Search.Everything;
|
|||
using System.Windows.Input;
|
||||
using System.Windows.Shapes;
|
||||
using Path = System.IO.Path;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search
|
||||
{
|
||||
|
|
@ -189,11 +190,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
if (mok == 1)
|
||||
uom = "KB";
|
||||
else if (mok == 2)
|
||||
uom = " MB";
|
||||
uom = "MB";
|
||||
else if (mok == 3)
|
||||
uom = " GB";
|
||||
uom = "GB";
|
||||
else if (mok == 4)
|
||||
uom = " TB";
|
||||
uom = "TB";
|
||||
|
||||
var returnStr = $"{Convert.ToInt32(drvSize)}{uom}";
|
||||
if (mok != 0)
|
||||
|
|
@ -241,14 +242,16 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
var title = Path.GetFileName(filePath);
|
||||
|
||||
|
||||
/* Preview Detail */
|
||||
long fileSize = new System.IO.FileInfo(filePath).Length;
|
||||
string fileSizStr = fileSize.ToString();
|
||||
string fileSizStr = ToReadableSize(fileSize, 2);
|
||||
|
||||
DateTime created = System.IO.File.GetCreationTime(filePath);
|
||||
string createdStr = created.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string createdStr = created.ToString("yy-M-dd ddd hh:mm", CultureInfo.CurrentCulture);
|
||||
DateTime lastModified = System.IO.File.GetLastWriteTime(filePath);
|
||||
string lastModifiedStr = lastModified.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string lastModifiedStr = lastModified.ToString("yy-M-dd ddd hh:mm", CultureInfo.CurrentCulture);
|
||||
|
||||
|
||||
|
||||
var result = new Result
|
||||
|
|
|
|||
Loading…
Reference in a new issue