From 3b0551ff3708d2e9fa07d0c1b51de8d7674f29ea Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 31 Aug 2022 15:21:52 +0900 Subject: [PATCH 01/18] - Add Clock Code - Add Base Clock Style --- Flow.Launcher.sln | 1 - Flow.Launcher/MainWindow.xaml | 4 ++ Flow.Launcher/MainWindow.xaml.cs | 19 ++++++++- Flow.Launcher/Themes/Base.xaml | 70 ++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.sln b/Flow.Launcher.sln index ec4a29ee78d..9d5f355d863 100644 --- a/Flow.Launcher.sln +++ b/Flow.Launcher.sln @@ -273,7 +273,6 @@ Global {4792A74A-0CEA-4173-A8B2-30E6764C6217}.Release|x86.ActiveCfg = Release|Any CPU {4792A74A-0CEA-4173-A8B2-30E6764C6217}.Release|x86.Build.0 = Release|Any CPU {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|Any CPU.Build.0 = Debug|Any CPU {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x64.ActiveCfg = Debug|Any CPU {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x64.Build.0 = Debug|Any CPU {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x86.ActiveCfg = Debug|Any CPU diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 714fcc53fa1..8bed94383b2 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -192,6 +192,10 @@ + + + + + + + + + + + @@ -105,19 +104,19 @@ x:Key="ClockBox" BasedOn="{StaticResource BaseClockBox}" TargetType="{x:Type TextBlock}"> - + + - - - - - + - - - - #2c313c - - - - - - - + + diff --git a/Flow.Launcher/Themes/BlurBlack Darker.xaml b/Flow.Launcher/Themes/BlurBlack Darker.xaml index 98ab77314b3..a26f45c6384 100644 --- a/Flow.Launcher/Themes/BlurBlack Darker.xaml +++ b/Flow.Launcher/Themes/BlurBlack Darker.xaml @@ -1,79 +1,125 @@ - + True - - - - - - - - - - - #356ef3 - - - - + + diff --git a/Flow.Launcher/Themes/BlurWhite.xaml b/Flow.Launcher/Themes/BlurWhite.xaml index 99b5b222cd1..92ab9b5a39a 100644 --- a/Flow.Launcher/Themes/BlurWhite.xaml +++ b/Flow.Launcher/Themes/BlurWhite.xaml @@ -1,71 +1,115 @@ - + True - - - - - + - - - #356ef3 - - - - + + diff --git a/Flow.Launcher/Themes/Darker Glass.xaml b/Flow.Launcher/Themes/Darker Glass.xaml index de37dd19220..13c9e2bc5b8 100644 --- a/Flow.Launcher/Themes/Darker Glass.xaml +++ b/Flow.Launcher/Themes/Darker Glass.xaml @@ -1,84 +1,131 @@ - + - - - - - - + - - - #545454 - - - - - - + + diff --git a/Flow.Launcher/Themes/Darker.xaml b/Flow.Launcher/Themes/Darker.xaml index 675092bf8ab..b255c4d9eb4 100644 --- a/Flow.Launcher/Themes/Darker.xaml +++ b/Flow.Launcher/Themes/Darker.xaml @@ -1,51 +1,97 @@ - + - - - - + + + - - - #4d4d4d - - - + + + diff --git a/Flow.Launcher/Themes/Discord Dark.xaml b/Flow.Launcher/Themes/Discord Dark.xaml index 636fe7b6d38..92b8d8da75c 100644 --- a/Flow.Launcher/Themes/Discord Dark.xaml +++ b/Flow.Launcher/Themes/Discord Dark.xaml @@ -1,64 +1,101 @@ - + - - - - - - - - - - - - #49443c - - - - - - + + diff --git a/Flow.Launcher/Themes/Dracula.xaml b/Flow.Launcher/Themes/Dracula.xaml index c661d33e331..146038ba9c2 100644 --- a/Flow.Launcher/Themes/Dracula.xaml +++ b/Flow.Launcher/Themes/Dracula.xaml @@ -1,64 +1,100 @@ - + - - - - - - + - - - - #44475a - - - - - - - + + + diff --git a/Flow.Launcher/Themes/Gray.xaml b/Flow.Launcher/Themes/Gray.xaml index c3cec7bd86f..1cacc8ec22d 100644 --- a/Flow.Launcher/Themes/Gray.xaml +++ b/Flow.Launcher/Themes/Gray.xaml @@ -1,61 +1,107 @@ - + - - - - - - - - - - #787878 - - - + + + diff --git a/Flow.Launcher/Themes/League.xaml b/Flow.Launcher/Themes/League.xaml index 06649978bd9..c64bf0a8b4d 100644 --- a/Flow.Launcher/Themes/League.xaml +++ b/Flow.Launcher/Themes/League.xaml @@ -1,61 +1,102 @@ - + - + - - - - - - - - - - #192026 - - - + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Metro Server.xaml b/Flow.Launcher/Themes/Metro Server.xaml index 016e6af9dd0..cbd70dbaff6 100644 --- a/Flow.Launcher/Themes/Metro Server.xaml +++ b/Flow.Launcher/Themes/Metro Server.xaml @@ -1,48 +1,83 @@ - + - - - - - - - - - - #04152E - - - + + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Nord Darker.xaml b/Flow.Launcher/Themes/Nord Darker.xaml index 413effa518b..7c29eda2276 100644 --- a/Flow.Launcher/Themes/Nord Darker.xaml +++ b/Flow.Launcher/Themes/Nord Darker.xaml @@ -1,64 +1,110 @@ - + - - - - - - - - - - - #4e586b - - - + + + diff --git a/Flow.Launcher/Themes/Nord.xaml b/Flow.Launcher/Themes/Nord.xaml index 2fcc11ef2bd..73504165667 100644 --- a/Flow.Launcher/Themes/Nord.xaml +++ b/Flow.Launcher/Themes/Nord.xaml @@ -1,63 +1,109 @@ - + - - - - - - - - - - - #596479 - - - + + diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index cb5f56a8e75..7e1ae911a7a 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -1,63 +1,102 @@ - + - + - - - - - - + - - - + - #cc1081 - - + @@ -74,4 +113,16 @@ + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Sublime.xaml b/Flow.Launcher/Themes/Sublime.xaml index 82fff06ff84..1b6f25e83c0 100644 --- a/Flow.Launcher/Themes/Sublime.xaml +++ b/Flow.Launcher/Themes/Sublime.xaml @@ -1,64 +1,101 @@ - + - - - - - - - - - - - - #3c454e - - - - - - + + diff --git a/Flow.Launcher/Themes/Win10Light.xaml b/Flow.Launcher/Themes/Win10Light.xaml index 6f487a89521..ad16f390e0f 100644 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ b/Flow.Launcher/Themes/Win10Light.xaml @@ -1,67 +1,104 @@ - + - - - - - - - - - - - - #ccd0d4 - - - - - - + + + diff --git a/Flow.Launcher/Themes/Win11Dark.xaml b/Flow.Launcher/Themes/Win11Dark.xaml index 31f6fb9561b..aa510acaf13 100644 --- a/Flow.Launcher/Themes/Win11Dark.xaml +++ b/Flow.Launcher/Themes/Win11Dark.xaml @@ -156,4 +156,16 @@ + + diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index 33aa6cdee38..2cba6776025 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -1,64 +1,100 @@ - + - - - - - - + - - - - #198F8F8F - - - - - - - + + + diff --git a/Flow.Launcher/Themes/Win11System.xaml b/Flow.Launcher/Themes/Win11System.xaml index bcc83be9fdf..3cf7fd12329 100644 --- a/Flow.Launcher/Themes/Win11System.xaml +++ b/Flow.Launcher/Themes/Win11System.xaml @@ -156,4 +156,16 @@ + + From d2332abd95251f07f2df4e296cf423bb493307a0 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 1 Sep 2022 16:19:00 +0900 Subject: [PATCH 06/18] - Add Clock/Date in SettingWindow --- .../UserSettings/Settings.cs | 2 +- Flow.Launcher/Languages/en.xaml | 2 + Flow.Launcher/MainWindow.xaml.cs | 30 ++++++- Flow.Launcher/SettingWindow.xaml | 78 ++++++++++++++++--- .../ViewModel/SettingWindowViewModel.cs | 13 ++++ 5 files changed, 114 insertions(+), 11 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index b5f2ac18e40..6b783a21052 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -42,7 +42,7 @@ public string Language public bool UseAnimation { get; set; } = true; public bool UseSound { get; set; } = true; public bool UseClock { get; set; } = true; - public bool UseDate { get; set; } = true; + public bool UseDate { get; set; } = false; public bool FirstLaunch { get; set; } = true; public int CustomExplorerIndex { get; set; } = 0; diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index bdf7450525c..79afe099807 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -105,6 +105,8 @@ Play a small sound when the search window opens Animation Use Animation in UI + Clock + Date Hotkey diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 1fcccd8d2d3..080486c5e1a 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -81,6 +81,29 @@ private void Timer_Tick(object sender, EventArgs e) } + } + + public void ClockDisplay() + { + if (_settings.UseClock == true) + { + ClockBox.Visibility = Visibility.Visible; + ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm"); + } + else if (_settings.UseClock == false) + { + ClockBox.Visibility = Visibility.Collapsed; + } + if (_settings.UseDate == true) + { + DateBox.Visibility = Visibility.Visible; + DateBox.Text = System.DateTime.Now.ToString("MM/dd ddd"); + } + else if (_settings.UseDate == false) + { + DateBox.Visibility = Visibility.Collapsed; + } + } private void OnCopy(object sender, ExecutedRoutedEventArgs e) { @@ -206,6 +229,12 @@ private void OnLoaded(object sender, RoutedEventArgs _) case nameof(Settings.Hotkey): UpdateNotifyIconText(); break; + case nameof(Settings.UseClock): + ClockDisplay(); + break; + case nameof(Settings.UseDate): + ClockDisplay(); + break; } }; } @@ -378,7 +407,6 @@ public void WindowAnimator() _settings.WindowLeft = Left; _settings.WindowTop = Top; iconsb.Begin(SearchIcon); - iconsb.Begin(ClockPanel); sb.Begin(FlowMainWindow); } diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 06c9549e231..144edf5d16f 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -597,9 +597,7 @@ - + @@ -1555,8 +1553,17 @@ IsReadOnly="True" Style="{DynamicResource QueryBoxStyle}" Text="{DynamicResource hiThere}" /> - + + + + + SelectedItem="{Binding SelectedQueryBoxFont}" /> + SelectedItem="{Binding SelectedResultFont}" /> + + + + + + + + +  + + + + + + + + + + + +  + + + + + + + diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index a63e54f3b0a..95758c471b2 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -385,6 +385,19 @@ public bool UseSound set => Settings.UseSound = value; } + public bool UseClock + { + get => Settings.UseClock; + set => Settings.UseClock = value; + } + + public bool UseDate + { + get => Settings.UseDate; + set => Settings.UseDate = value; + } + + public Brush PreviewBackground { get From 8e6af08b4df3f8b7c3bd01038e0338f071e6a7fb Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 5 Sep 2022 13:47:16 +0900 Subject: [PATCH 07/18] Add Clock/Date Format Combobox UI in settingswindow --- Flow.Launcher/SettingWindow.xaml | 38 +++++++++++++++++++++++++---- Flow.Launcher/SettingWindow.xaml.cs | 5 ++++ 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 88b80a89f6d..ca310fce81f 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1897,13 +1897,27 @@ - + + + @@ -1921,13 +1935,27 @@ + + + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 10c9aeffeec..45253848538 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -348,5 +348,10 @@ private void ItemSizeChanged(object sender, SizeChangedEventArgs e) { Plugins.ScrollIntoView(Plugins.SelectedItem); } + + private void ColorSchemeSelectedIndexChanged(object sender, SelectionChangedEventArgs e) + { + + } } } From 7ae6f2ac7dbfd15d9685b66f0bdb653b89853720 Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 5 Sep 2022 15:48:10 +0900 Subject: [PATCH 08/18] - Add Timeformat to changable list --- .../UserSettings/Settings.cs | 2 ++ Flow.Launcher/MainWindow.xaml.cs | 23 ++------------- Flow.Launcher/SettingWindow.xaml | 29 +++++++------------ .../ViewModel/SettingWindowViewModel.cs | 19 ++++++++++++ 4 files changed, 35 insertions(+), 38 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 6b783a21052..26b89be861d 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -43,6 +43,8 @@ public string Language public bool UseSound { get; set; } = true; public bool UseClock { get; set; } = true; public bool UseDate { get; set; } = false; + public string TimeFormat { get; set; } = "hh:mm tt "; + public string DateFormat { get; set; } = "MM'/'dd ddd"; public bool FirstLaunch { get; set; } = true; public int CustomExplorerIndex { get; set; } = 0; diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 080486c5e1a..bc18d8dbce0 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -63,24 +63,7 @@ public MainWindow() } private void Timer_Tick(object sender, EventArgs e) { - if (_settings.UseClock == true) - { - ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm"); - } - else if(_settings.UseClock == false) - { - ClockBox.Visibility = Visibility.Collapsed; - } - if (_settings.UseDate == true) - { - DateBox.Text = System.DateTime.Now.ToString("MM/dd ddd"); - } - else if (_settings.UseDate == false) - { - DateBox.Visibility = Visibility.Collapsed; - } - - + ClockDisplay(); } public void ClockDisplay() @@ -88,7 +71,7 @@ public void ClockDisplay() if (_settings.UseClock == true) { ClockBox.Visibility = Visibility.Visible; - ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm"); + ClockBox.Text = System.DateTime.Now.ToString(_settings.TimeFormat); } else if (_settings.UseClock == false) { @@ -97,7 +80,7 @@ public void ClockDisplay() if (_settings.UseDate == true) { DateBox.Visibility = Visibility.Visible; - DateBox.Text = System.DateTime.Now.ToString("MM/dd ddd"); + DateBox.Text = System.DateTime.Now.ToString(_settings.DateFormat); } else if (_settings.UseDate == false) { diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index ca310fce81f..0c92f073f53 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1,17 +1,16 @@ + ItemsSource="{Binding TimeFormatList}" + SelectedValue="{Binding Settings.TimeFormat}"/> + ItemsSource="{Binding DateFormatList}" + SelectedValue="{Binding Settings.DateFormat}" + /> ColorSchemes } } + public List TimeFormatList { get; set; } = new List() + { + "hh:mm", + "HH:mm", + "tt hh:mm", + "hh:mm tt" + }; + + public List DateFormatList { get; set; } = new List() + { + "MM'/'dd dddd", + "MM'/'dd ddd", + "MM'/'dd", + "dd'/'MM", + "ddd MM'/'dd", + "dddd MM'/'dd", + "dddd" + }; + public double WindowWidthSize { get => Settings.WindowSize; From 7e0ef2a400954bb674e1c640095ef098d2c4435c Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 5 Sep 2022 16:58:56 +0900 Subject: [PATCH 09/18] - Refresh Preview when Change Time/Date Format --- Flow.Launcher/SettingWindow.xaml | 92 ++++++++++++++--------------- Flow.Launcher/SettingWindow.xaml.cs | 28 +++++++++ 2 files changed, 73 insertions(+), 47 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 0c92f073f53..e960b735503 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1,16 +1,16 @@ - - + + - - + + + IsOn="{Binding UseClock, Mode=TwoWay}" + OffContent="{DynamicResource disable}" + OnContent="{DynamicResource enable}" + Style="{DynamicResource SideToggleSwitch}" />  @@ -1931,23 +1927,25 @@ - - - + + +  diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 45253848538..3672053a825 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -54,6 +54,7 @@ private void OnLoaded(object sender, RoutedEventArgs e) HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource; HwndTarget hwndTarget = hwndSource.CompositionTarget; hwndTarget.RenderMode = RenderMode.SoftwareOnly; + ClockDisplay(); } private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e) @@ -353,5 +354,32 @@ private void ColorSchemeSelectedIndexChanged(object sender, SelectionChangedEven { } + + private void PreviewClockAndDate(object sender, RoutedEventArgs e) + { + ClockDisplay(); + } + public void ClockDisplay() + { + if (settings.UseClock == true) + { + ClockBox.Visibility = Visibility.Visible; + ClockBox.Text = System.DateTime.Now.ToString(settings.TimeFormat); + } + else if (settings.UseClock == false) + { + ClockBox.Visibility = Visibility.Collapsed; + } + if (settings.UseDate == true) + { + DateBox.Visibility = Visibility.Visible; + DateBox.Text = System.DateTime.Now.ToString(settings.DateFormat); + } + else if (settings.UseDate == false) + { + DateBox.Visibility = Visibility.Collapsed; + } + + } } } From 61cdc73068b70c606cdc68621a8c8d7013a9bd2f Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 5 Sep 2022 19:44:30 +0900 Subject: [PATCH 10/18] - Toggle Clock/Date Display in Theme Preview --- Flow.Launcher/SettingWindow.xaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index e960b735503..8dd2a381413 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1908,7 +1908,8 @@ IsOn="{Binding UseClock, Mode=TwoWay}" OffContent="{DynamicResource disable}" OnContent="{DynamicResource enable}" - Style="{DynamicResource SideToggleSwitch}" /> + Style="{DynamicResource SideToggleSwitch}" + Toggled="PreviewClockAndDate" />  @@ -1945,7 +1946,8 @@ IsOn="{Binding UseDate, Mode=TwoWay}" OffContent="{DynamicResource disable}" OnContent="{DynamicResource enable}" - Style="{DynamicResource SideToggleSwitch}" /> + Style="{DynamicResource SideToggleSwitch}" + Toggled="PreviewClockAndDate" />  From 0566a6c6d697bed0449fe371c5d803d08981b4d7 Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 27 Sep 2022 19:52:40 +0900 Subject: [PATCH 11/18] Change the clock to it cannot be clicked --- Flow.Launcher/MainWindow.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index bc1dda0e55e..7e4c755412f 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -193,7 +193,7 @@ - + From 52cd8a8c3381e20d5997887b5cf5f605536f29b5 Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 3 Oct 2022 15:06:44 +0900 Subject: [PATCH 12/18] Adjust Clock Code --- Flow.Launcher/MainWindow.xaml.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index bc18d8dbce0..4eac8f9b587 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -22,6 +22,7 @@ using Flow.Launcher.Plugin.SharedCommands; using System.Windows.Threading; using System.Globalization; +using System.Reflection.Emit; namespace Flow.Launcher { @@ -47,11 +48,15 @@ public MainWindow(Settings settings, MainViewModel mainVM) _settings = settings; - DispatcherTimer timer = new DispatcherTimer(); - timer.Interval = new TimeSpan(0, 0, 1); - timer.Tick += Timer_Tick; + var timer = new Timer + { + Interval = 1000, + }; + timer.Tick += (s, evt) => + { + ClockDisplay(); + }; timer.Start(); - InitializeComponent(); InitializePosition(); animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); @@ -61,10 +66,6 @@ public MainWindow() { InitializeComponent(); } - private void Timer_Tick(object sender, EventArgs e) - { - ClockDisplay(); - } public void ClockDisplay() { From aa75aa64f9e7d2079e769f9a8e34611443691515 Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 3 Oct 2022 15:22:59 +0900 Subject: [PATCH 13/18] Fix Formatting --- Flow.Launcher/SettingWindow.xaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index d3d1c1f1381..e0b8498ae8d 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -381,7 +381,7 @@ public void ClockDisplay() { DateBox.Visibility = Visibility.Collapsed; } - + } private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e) { @@ -394,5 +394,6 @@ private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs API.ShowMainWindow(); } } + } } From 03d8b508911924ee8ddba257f0f39c89f4e2e0ec Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 11 Oct 2022 15:14:19 +0900 Subject: [PATCH 14/18] Fix Default TimeFormat --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 26b89be861d..4d07ea658e7 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -43,7 +43,7 @@ public string Language public bool UseSound { get; set; } = true; public bool UseClock { get; set; } = true; public bool UseDate { get; set; } = false; - public string TimeFormat { get; set; } = "hh:mm tt "; + public string TimeFormat { get; set; } = "hh:mm tt"; public string DateFormat { get; set; } = "MM'/'dd ddd"; public bool FirstLaunch { get; set; } = true; From 50702d80cc03b1d239e95a269e53a350ce5d71e7 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Tue, 11 Oct 2022 23:01:50 -0500 Subject: [PATCH 15/18] Refactor Clcok/Date code to viewmodel --- Flow.Launcher/Helper/HotKeyMapper.cs | 2 +- Flow.Launcher/MainWindow.xaml | 223 ++++++++++++----------- Flow.Launcher/MainWindow.xaml.cs | 41 +---- Flow.Launcher/ViewModel/MainViewModel.cs | 62 ++++--- 4 files changed, 156 insertions(+), 172 deletions(-) diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index a3ad20f7748..b9ac6afb3cd 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -17,7 +17,7 @@ internal static class HotKeyMapper internal static void Initialize(MainViewModel mainVM) { mainViewModel = mainVM; - settings = mainViewModel._settings; + settings = mainViewModel.Settings; SetHotkey(settings.Hotkey, OnToggleHotkey); LoadCustomPluginHotkey(); diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 68a4c2c237f..3b57e7a7076 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -1,5 +1,4 @@ - + - - - - - + + + + - - - - - - - - - - - - + + - - - - + - - - - - - - - - - - - + - - - - + + + - - + - - - - + + + - - + + - - - + + + - - - - - - - + + + - @@ -282,14 +283,16 @@ - - - + + + - @@ -297,14 +300,16 @@ - - - + + + - @@ -312,4 +317,4 @@ - + \ No newline at end of file diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 3646f1c87e2..1ae7f43bd90 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -48,17 +48,7 @@ public MainWindow(Settings settings, MainViewModel mainVM) DataContext = mainVM; _viewModel = mainVM; _settings = settings; - - - var timer = new Timer - { - Interval = 1000, - }; - timer.Tick += (s, evt) => - { - ClockDisplay(); - }; - timer.Start(); + InitializeComponent(); InitializePosition(); animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); @@ -69,28 +59,7 @@ public MainWindow() InitializeComponent(); } - public void ClockDisplay() - { - if (_settings.UseClock == true) - { - ClockBox.Visibility = Visibility.Visible; - ClockBox.Text = System.DateTime.Now.ToString(_settings.TimeFormat); - } - else if (_settings.UseClock == false) - { - ClockBox.Visibility = Visibility.Collapsed; - } - if (_settings.UseDate == true) - { - DateBox.Visibility = Visibility.Visible; - DateBox.Text = System.DateTime.Now.ToString(_settings.DateFormat); - } - else if (_settings.UseDate == false) - { - DateBox.Visibility = Visibility.Collapsed; - } - - } + private void OnCopy(object sender, ExecutedRoutedEventArgs e) { if (QueryTextBox.SelectionLength == 0) @@ -213,12 +182,6 @@ private void OnLoaded(object sender, RoutedEventArgs _) case nameof(Settings.Hotkey): UpdateNotifyIconText(); break; - case nameof(Settings.UseClock): - ClockDisplay(); - break; - case nameof(Settings.UseDate): - ClockDisplay(); - break; } }; } diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index e6289926104..aba9bc0104e 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -37,7 +37,6 @@ public class MainViewModel : BaseModel, ISavable private readonly FlowLauncherJsonStorage _historyItemsStorage; private readonly FlowLauncherJsonStorage _userSelectedRecordStorage; private readonly FlowLauncherJsonStorage _topMostRecordStorage; - internal readonly Settings _settings; private readonly History _history; private readonly UserSelectedRecord _userSelectedRecord; private readonly TopMostRecord _topMostRecord; @@ -60,8 +59,8 @@ public MainViewModel(Settings settings) _queryText = ""; _lastQuery = new Query(); - _settings = settings; - _settings.PropertyChanged += (_, args) => + Settings = settings; + Settings.PropertyChanged += (_, args) => { if (args.PropertyName == nameof(Settings.WindowSize)) { @@ -76,14 +75,15 @@ public MainViewModel(Settings settings) _userSelectedRecord = _userSelectedRecordStorage.Load(); _topMostRecord = _topMostRecordStorage.Load(); - ContextMenu = new ResultsViewModel(_settings); - Results = new ResultsViewModel(_settings); - History = new ResultsViewModel(_settings); + ContextMenu = new ResultsViewModel(Settings); + Results = new ResultsViewModel(Settings); + History = new ResultsViewModel(Settings); _selectedResults = Results; InitializeKeyCommands(); RegisterViewUpdate(); RegisterResultsUpdatedEvent(); + RegisterClockAndDateUpdateAsync(); SetOpenResultModifiers(); } @@ -307,7 +307,7 @@ private void InitializeKeyCommands() Notification.Show( InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully") - ); + ); }), TaskScheduler.Default) .ConfigureAwait(false); }); @@ -317,10 +317,26 @@ private void InitializeKeyCommands() #region ViewModel Properties + public Settings Settings { get; } + public object ClockText { get; private set; } + public string DateText { get; private set; } + + private async Task RegisterClockAndDateUpdateAsync() + { + var timer = new PeriodicTimer(TimeSpan.FromSeconds(1)); + // ReSharper disable once MethodSupportsCancellation + while (await timer.WaitForNextTickAsync().ConfigureAwait(false)) + { + if (Settings.UseClock) + ClockText = DateTime.Now.ToString(Settings.TimeFormat); + if (Settings.UseDate) + DateText = DateTime.Now.ToString(Settings.DateFormat); + } + } public ResultsViewModel Results { get; private set; } - + public ResultsViewModel ContextMenu { get; private set; } - + public ResultsViewModel History { get; private set; } public bool GameModeStatus { get; set; } @@ -411,7 +427,7 @@ private ResultsViewModel SelectedResults public Visibility SearchIconVisibility { get; set; } - public double MainWindowWidth => _settings.WindowSize; + public double MainWindowWidth => Settings.WindowSize; public string PluginIconPath { get; set; } = null; @@ -592,7 +608,7 @@ private async void QueryResults() PluginIconPath = null; SearchIconVisibility = Visibility.Visible; } - + if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign) { @@ -759,7 +775,7 @@ private bool HistorySelected() private void SetOpenResultModifiers() { - OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers; + OpenResultCommandModifiers = Settings.OpenResultModifiers ?? DefaultOpenResultModifiers; } public void ToggleFlowLauncher() @@ -788,24 +804,24 @@ public async void Hide() // Trick for no delay MainWindowOpacity = 0; - switch (_settings.LastQueryMode) + switch (Settings.LastQueryMode) { case LastQueryMode.Empty: ChangeQueryText(string.Empty); await Task.Delay(100); //Time for change to opacity break; case LastQueryMode.Preserved: - if (_settings.UseAnimation) + if (Settings.UseAnimation) await Task.Delay(100); LastQuerySelected = true; break; case LastQueryMode.Selected: - if (_settings.UseAnimation) + if (Settings.UseAnimation) await Task.Delay(100); LastQuerySelected = false; break; default: - throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>"); + throw new ArgumentException($"wrong LastQueryMode: <{Settings.LastQueryMode}>"); } MainWindowVisibilityStatus = false; @@ -820,7 +836,7 @@ public async void Hide() /// public bool ShouldIgnoreHotkeys() { - return _settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen(); + return Settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen(); } @@ -903,18 +919,18 @@ public void ResultCopy(string stringToCopy) Clipboard.SetFileDropList(paths); App.API.ShowMsg( - App.API.GetTranslation("copy") - +" " - + (isFile? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), + App.API.GetTranslation("copy") + + " " + + (isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), App.API.GetTranslation("completedSuccessfully")); } else { Clipboard.SetDataObject(copyText.ToString()); App.API.ShowMsg( - App.API.GetTranslation("copy") - + " " - + App.API.GetTranslation("textTitle"), + App.API.GetTranslation("copy") + + " " + + App.API.GetTranslation("textTitle"), App.API.GetTranslation("completedSuccessfully")); } } From cd6140dcb452821593045153d1cd8ae1461873bd Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 25 Oct 2022 21:45:06 +0900 Subject: [PATCH 16/18] Fix Conflicts --- Flow.Launcher/MainWindow.xaml | 5 +++- Flow.Launcher/ViewModel/MainViewModel.cs | 32 ++++++++++++------------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index bb5c28b0a32..6f391507650 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -80,7 +80,10 @@ Command="{Binding LoadContextMenuCommand}" /> - 1920 || _settings.WindowSize == 1920) + if (MainWindowWidth + 100 > 1920 || Settings.WindowSize == 1920) { - _settings.WindowSize = 1920; + Settings.WindowSize = 1920; } else - { - _settings.WindowSize += 100; - _settings.WindowLeft -= 50; + { + Settings.WindowSize += 100; + Settings.WindowLeft -= 50; } OnPropertyChanged(); } @@ -375,14 +375,14 @@ private void IncreaseWidth() [RelayCommand] private void DecreaseWidth() { - if (MainWindowWidth - 100 < 400 || _settings.WindowSize == 400) + if (MainWindowWidth - 100 < 400 || Settings.WindowSize == 400) { - _settings.WindowSize = 400; + Settings.WindowSize = 400; } else - { - _settings.WindowLeft += 50; - _settings.WindowSize -= 100; + { + Settings.WindowLeft += 50; + Settings.WindowSize -= 100; } OnPropertyChanged(); } @@ -390,19 +390,19 @@ private void DecreaseWidth() [RelayCommand] private void IncreaseMaxResult() { - if (_settings.MaxResultsToShow == 17) + if (Settings.MaxResultsToShow == 17) return; - _settings.MaxResultsToShow += 1; + Settings.MaxResultsToShow += 1; } [RelayCommand] private void DecreaseMaxResult() { - if (_settings.MaxResultsToShow == 2) + if (Settings.MaxResultsToShow == 2) return; - _settings.MaxResultsToShow -= 1; + Settings.MaxResultsToShow -= 1; } /// @@ -482,8 +482,8 @@ private ResultsViewModel SelectedResults public double MainWindowWidth { - get => _settings.WindowSize; - set => _settings.WindowSize = value; + get => Settings.WindowSize; + set => Settings.WindowSize = value; } public string PluginIconPath { get; set; } = null; From 6da3ca52d63f48e2e4bb3d552ac54267434efed3 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 2 Nov 2022 07:03:13 +1100 Subject: [PATCH 17/18] revert deleted sln config --- Flow.Launcher.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher.sln b/Flow.Launcher.sln index 09b1a0275bf..f59d3d26fb7 100644 --- a/Flow.Launcher.sln +++ b/Flow.Launcher.sln @@ -273,6 +273,7 @@ Global {4792A74A-0CEA-4173-A8B2-30E6764C6217}.Release|x86.ActiveCfg = Release|Any CPU {4792A74A-0CEA-4173-A8B2-30E6764C6217}.Release|x86.Build.0 = Release|Any CPU {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|Any CPU.Build.0 = Debug|Any CPU {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x64.ActiveCfg = Debug|Any CPU {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x64.Build.0 = Debug|Any CPU {5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x86.ActiveCfg = Debug|Any CPU From e54c91d1d2eaecad8ddf7609b4c8c173bbecb908 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 2 Nov 2022 07:47:31 +1100 Subject: [PATCH 18/18] formatting --- Flow.Launcher/MainWindow.xaml.cs | 4 ---- Flow.Launcher/SettingWindow.xaml.cs | 29 ++++++++--------------------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 3b61d2e4710..630daf42e6d 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -21,10 +21,7 @@ using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Plugin.SharedCommands; using System.Windows.Threading; -using System.Globalization; -using System.Reflection.Emit; using System.Windows.Data; -using System.Diagnostics; namespace Flow.Launcher { @@ -58,7 +55,6 @@ public MainWindow() { InitializeComponent(); } - private void OnCopy(object sender, ExecutedRoutedEventArgs e) { diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index e699c40a373..a7f2114ed28 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -1,31 +1,23 @@ -using Droplex; -using Flow.Launcher.Core.ExternalPlugins; -using Flow.Launcher.Core.Plugin; +using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Resource; using Flow.Launcher.Helper; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Hotkey; -using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.ViewModel; -using Microsoft.Win32; using ModernWpf; using System; using System.IO; -using System.Linq; using System.Windows; -using System.Windows.Controls; using System.Windows.Data; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Interop; -using System.Windows.Media; using System.Windows.Navigation; using Button = System.Windows.Controls.Button; using Control = System.Windows.Controls.Control; -using ListViewItem = System.Windows.Controls.ListViewItem; using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MessageBox = System.Windows.MessageBox; using TextBox = System.Windows.Controls.TextBox; @@ -467,33 +459,28 @@ private void PluginStore_OnKeyDown(object sender, KeyEventArgs e) } } - - private void ColorSchemeSelectedIndexChanged(object sender, SelectionChangedEventArgs e) - { - - } - private void PreviewClockAndDate(object sender, RoutedEventArgs e) { ClockDisplay(); } public void ClockDisplay() { - if (settings.UseClock == true) + if (settings.UseClock) { ClockBox.Visibility = Visibility.Visible; - ClockBox.Text = System.DateTime.Now.ToString(settings.TimeFormat); + ClockBox.Text = DateTime.Now.ToString(settings.TimeFormat); } - else if (settings.UseClock == false) + else { ClockBox.Visibility = Visibility.Collapsed; } - if (settings.UseDate == true) + + if (settings.UseDate) { DateBox.Visibility = Visibility.Visible; - DateBox.Text = System.DateTime.Now.ToString(settings.DateFormat); + DateBox.Text = DateTime.Now.ToString(settings.DateFormat); } - else if (settings.UseDate == false) + else { DateBox.Visibility = Visibility.Collapsed; }