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="uninstallbtn">Uninstall</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="LabelNew">New Version</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}}" />
<Border
x:Name="Labelinstalled"
Height="12"
Margin="0,10,8,0"
Padding="6,2,6,2"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="{DynamicResource ToggleSwitchFillOn}"
CornerRadius="4"
CornerRadius="36"
ToolTip="{DynamicResource LabelInstalledToolTip}"
Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}}">
<TextBlock
FontSize="11"
Foreground="{DynamicResource Color01B}"
Text="{DynamicResource LabelInstalled}" />
</Border>
Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}}" />
</StackPanel>
<StackPanel

View file

@ -27,9 +27,7 @@ namespace Flow.Launcher.ViewModel
public string IcoPath => _plugin.IcoPath;
public bool LabelInstalled => PluginManager.GetPluginForId(_plugin.ID) != null;
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 bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version;
public string Category
{
get

View file

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