From d2332abd95251f07f2df4e296cf423bb493307a0 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 1 Sep 2022 16:19:00 +0900 Subject: [PATCH] - 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