Adjust Label / Fix Order

This commit is contained in:
DB p 2022-10-23 16:38:33 +09:00
parent e154b12674
commit b9afa1370a
4 changed files with 8 additions and 14 deletions

View file

@ -95,7 +95,6 @@
<system:String x:Key="installbtn">Install</system:String> <system:String x:Key="installbtn">Install</system:String>
<system:String x:Key="uninstallbtn">Uninstall</system:String> <system:String x:Key="uninstallbtn">Uninstall</system:String>
<system:String x:Key="updatebtn">Update</system:String> <system:String x:Key="updatebtn">Update</system:String>
<system:String x:Key="LabelInstalled">Installed</system:String>
<system:String x:Key="LabelInstalledToolTip">Plug-in already installed</system:String> <system:String x:Key="LabelInstalledToolTip">Plug-in already installed</system:String>
<system:String x:Key="LabelNew">New Version</system:String> <system:String x:Key="LabelNew">New Version</system:String>
<system:String x:Key="LabelNewToolTip">This plug-in has been updated within the last 7 days</system:String> <system:String x:Key="LabelNewToolTip">This plug-in has been updated within the last 7 days</system:String>

View file

@ -1558,19 +1558,15 @@
Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" /> Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" />
<Border <Border
x:Name="Labelinstalled" x:Name="Labelinstalled"
Height="12"
Margin="0,10,8,0" Margin="0,10,8,0"
Padding="6,2,6,2" Padding="6,2,6,2"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalAlignment="Top"
Background="{DynamicResource ToggleSwitchFillOn}" Background="{DynamicResource ToggleSwitchFillOn}"
CornerRadius="4" CornerRadius="36"
ToolTip="{DynamicResource LabelInstalledToolTip}" ToolTip="{DynamicResource LabelInstalledToolTip}"
Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}}"> Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}}" />
<TextBlock
FontSize="11"
Foreground="{DynamicResource Color01B}"
Text="{DynamicResource LabelInstalled}" />
</Border>
</StackPanel> </StackPanel>
<StackPanel <StackPanel

View file

@ -27,9 +27,7 @@ namespace Flow.Launcher.ViewModel
public string IcoPath => _plugin.IcoPath; public string IcoPath => _plugin.IcoPath;
public bool LabelInstalled => PluginManager.GetPluginForId(_plugin.ID) != null; public bool LabelInstalled => PluginManager.GetPluginForId(_plugin.ID) != null;
public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version; public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version;
public bool LabelNew => DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7) && !LabelUpdate; // Show Update Label show first.
public string Category public string Category
{ {
get get

View file

@ -296,9 +296,10 @@ namespace Flow.Launcher.ViewModel
private IList<PluginStoreItemViewModel> LabelMaker(IList<UserPlugin> list) private IList<PluginStoreItemViewModel> LabelMaker(IList<UserPlugin> list)
{ {
return list.Select(p=>new PluginStoreItemViewModel(p)) return list.Select(p=>new PluginStoreItemViewModel(p))
.OrderByDescending(p=>p.LabelNew) .OrderByDescending(p => p.Category == "NewRelease")
.ThenByDescending(p=>p.LabelUpdate) .ThenByDescending(p=>p.Category == "RecentlyUpdated")
.ThenBy(p=>p.LabelInstalled) .ThenByDescending(p => p.Category == "None")
.ThenByDescending(p => p.Category == "Installed")
.ToList(); .ToList();
} }