From 3b0551ff3708d2e9fa07d0c1b51de8d7674f29ea Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 31 Aug 2022 15:21:52 +0900 Subject: [PATCH 01/19] - 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 ec4a29ee7..9d5f355d8 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 714fcc53f..8bed94383 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 98ab77314..a26f45c63 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 99b5b222c..92ab9b5a3 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 de37dd192..13c9e2bc5 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 675092bf8..b255c4d9e 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 636fe7b6d..92b8d8da7 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 c661d33e3..146038ba9 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 c3cec7bd8..1cacc8ec2 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 06649978b..c64bf0a8b 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 016e6af9d..cbd70dbaf 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 413effa51..7c29eda22 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 2fcc11ef2..735041656 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 cb5f56a8e..7e1ae911a 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 82fff06ff..1b6f25e83 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 6f487a895..ad16f390e 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 31f6fb956..aa510acaf 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 33aa6cdee..2cba67760 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 bcc83be9f..3cf7fd123 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/19] - 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 b5f2ac18e..6b783a210 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -42,7 +42,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings 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 bdf745052..79afe0998 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 1fcccd8d2..080486c5e 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -81,6 +81,29 @@ namespace Flow.Launcher } + } + + 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 @@ namespace Flow.Launcher case nameof(Settings.Hotkey): UpdateNotifyIconText(); break; + case nameof(Settings.UseClock): + ClockDisplay(); + break; + case nameof(Settings.UseDate): + ClockDisplay(); + break; } }; } @@ -378,7 +407,6 @@ namespace Flow.Launcher _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 06c9549e2..144edf5d1 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 a63e54f3b..95758c471 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -385,6 +385,19 @@ namespace Flow.Launcher.ViewModel 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/19] 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 88b80a89f..ca310fce8 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 10c9aeffe..452538485 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -348,5 +348,10 @@ namespace Flow.Launcher { 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/19] - 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 6b783a210..26b89be86 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -43,6 +43,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings 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 080486c5e..bc18d8dbc 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -63,24 +63,7 @@ namespace Flow.Launcher } 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 @@ namespace Flow.Launcher 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 @@ namespace Flow.Launcher 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 ca310fce8..0c92f073f 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}" + /> 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/19] - 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 0c92f073f..e960b7355 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 452538485..3672053a8 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -54,6 +54,7 @@ namespace Flow.Launcher 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 @@ namespace Flow.Launcher { } + + 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/19] - 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 e960b7355..8dd2a3814 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/19] 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 bc1dda0e5..7e4c75541 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/19] 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 bc18d8dbc..4eac8f9b5 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -22,6 +22,7 @@ using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Plugin.SharedCommands; using System.Windows.Threading; using System.Globalization; +using System.Reflection.Emit; namespace Flow.Launcher { @@ -47,11 +48,15 @@ namespace Flow.Launcher _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 @@ namespace Flow.Launcher { 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/19] 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 d3d1c1f13..e0b8498ae 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -381,7 +381,7 @@ namespace Flow.Launcher { DateBox.Visibility = Visibility.Collapsed; } - + } private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e) { @@ -394,5 +394,6 @@ namespace Flow.Launcher 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/19] 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 26b89be86..4d07ea658 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -43,7 +43,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings 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/19] 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 a3ad20f77..b9ac6afb3 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -17,7 +17,7 @@ namespace Flow.Launcher.Helper 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 68a4c2c23..3b57e7a70 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 3646f1c87..1ae7f43bd 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -48,17 +48,7 @@ namespace Flow.Launcher 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 @@ namespace Flow.Launcher 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 @@ namespace Flow.Launcher 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 e62899261..aba9bc010 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -37,7 +37,6 @@ namespace Flow.Launcher.ViewModel 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 @@ namespace Flow.Launcher.ViewModel _queryText = ""; _lastQuery = new Query(); - _settings = settings; - _settings.PropertyChanged += (_, args) => + Settings = settings; + Settings.PropertyChanged += (_, args) => { if (args.PropertyName == nameof(Settings.WindowSize)) { @@ -76,14 +75,15 @@ namespace Flow.Launcher.ViewModel _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 @@ namespace Flow.Launcher.ViewModel Notification.Show( InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully") - ); + ); }), TaskScheduler.Default) .ConfigureAwait(false); }); @@ -317,10 +317,26 @@ namespace Flow.Launcher.ViewModel #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 @@ namespace Flow.Launcher.ViewModel 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 @@ namespace Flow.Launcher.ViewModel PluginIconPath = null; SearchIconVisibility = Visibility.Visible; } - + if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign) { @@ -759,7 +775,7 @@ namespace Flow.Launcher.ViewModel private void SetOpenResultModifiers() { - OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers; + OpenResultCommandModifiers = Settings.OpenResultModifiers ?? DefaultOpenResultModifiers; } public void ToggleFlowLauncher() @@ -788,24 +804,24 @@ namespace Flow.Launcher.ViewModel // 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 @@ namespace Flow.Launcher.ViewModel /// public bool ShouldIgnoreHotkeys() { - return _settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen(); + return Settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen(); } @@ -903,18 +919,18 @@ namespace Flow.Launcher.ViewModel 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/19] 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 bb5c28b0a..6f3915076 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 @@ namespace Flow.Launcher.ViewModel [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 @@ namespace Flow.Launcher.ViewModel [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 @@ namespace Flow.Launcher.ViewModel 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/19] revert deleted sln config --- Flow.Launcher.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher.sln b/Flow.Launcher.sln index 09b1a0275..f59d3d26f 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/19] 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 3b61d2e47..630daf42e 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -21,10 +21,7 @@ using System.Windows.Media; 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 @@ namespace Flow.Launcher { InitializeComponent(); } - private void OnCopy(object sender, ExecutedRoutedEventArgs e) { diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index e699c40a3..a7f2114ed 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 @@ namespace Flow.Launcher } } - - 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; } From 81555ecdb550981b26ce434e21e0931801517059 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 2 Nov 2022 08:18:10 +1100 Subject: [PATCH 19/19] formatting --- Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml index b09a998ce..1d0267e3d 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml @@ -151,10 +151,6 @@ TextWrapping="Wrap" /> - -