From e154b126744f95de39a57c732ecbe9db70109c75 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 23 Oct 2022 16:16:26 +0900 Subject: [PATCH] - Add GroupName - Adjust Labels --- Flow.Launcher/Converters/TextConverter.cs | 43 +++++++++++++++ Flow.Launcher/Languages/en.xaml | 5 +- Flow.Launcher/MainWindow.xaml | 2 +- Flow.Launcher/SettingWindow.xaml | 52 +++++++++++-------- Flow.Launcher/SettingWindow.xaml.cs | 4 ++ .../ViewModel/PluginStoreItemViewModel.cs | 22 ++++++++ .../ViewModel/SettingWindowViewModel.cs | 3 +- 7 files changed, 106 insertions(+), 25 deletions(-) create mode 100644 Flow.Launcher/Converters/TextConverter.cs diff --git a/Flow.Launcher/Converters/TextConverter.cs b/Flow.Launcher/Converters/TextConverter.cs new file mode 100644 index 000000000..905b728a3 --- /dev/null +++ b/Flow.Launcher/Converters/TextConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using Flow.Launcher.Core.Resource; + +namespace Flow.Launcher.Converters +{ + public class TextConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var ID = value.ToString(); + switch(ID) + { + case "NewRelease": + return InternationalizationManager.Instance.GetTranslation("pluginStore_NewRelease"); + break; + case "RecentlyUpdated": + return InternationalizationManager.Instance.GetTranslation("pluginStore_RecentlyUpdated"); + break; + case "None": + return InternationalizationManager.Instance.GetTranslation("pluginStore_None"); + break; + case "installed": + return InternationalizationManager.Instance.GetTranslation("pluginStore_Installed"); + break; + default: + return ID; + break; + } + + + } + + public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException(); + } +} diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 517edd65f..d8dcb1d5b 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -87,6 +87,10 @@ Plugin Store + New Release + Recently Updated + Plugins + Installed Refresh Install Uninstall @@ -95,7 +99,6 @@ Plug-in already installed New Version This plug-in has been updated within the last 7 days - Update New Update is Available diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index dc3b3f145..627b80252 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -177,9 +177,9 @@ AllowDrop="True" Background="Transparent" PreviewDragOver="OnPreviewDragOver" + PreviewKeyUp="QueryTextBox_KeyUp" Style="{DynamicResource QueryBoxStyle}" Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" - PreviewKeyUp="QueryTextBox_KeyUp" Visibility="Visible"> diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 3f17305d7..ba641eb6e 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -41,6 +41,7 @@ + @@ -1463,6 +1464,32 @@ ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionMode="Single" Style="{DynamicResource StoreListStyle}"> + + + + + + + - - - - - + Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" /> 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 string Category + { + get + { + string category = "None"; + if (DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7)) + { + category = "RecentlyUpdated"; + } + if (DateTime.Now - _plugin.DateAdded < TimeSpan.FromDays(7)) + { + category = "NewRelease"; + } + if (PluginManager.GetPluginForId(_plugin.ID) != null) + { + category = "Installed"; + } + + return category; + } + } } } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 11c2d5329..b1ed5a411 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -2,12 +2,14 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Data; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; @@ -326,7 +328,6 @@ namespace Flow.Launcher.ViewModel } - #endregion #region theme