diff --git a/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs b/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs new file mode 100644 index 000000000..3c46fd01a --- /dev/null +++ b/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs @@ -0,0 +1,19 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Flow.Launcher.Converters +{ + public class DateTimeFormatToNowConverter : IValueConverter + { + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value is not string format ? null : DateTime.Now.ToString(format); + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index f6f52d3ef..d2ad5e6c7 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -250,13 +250,15 @@ IsHitTestVisible="False" Style="{DynamicResource ClockPanel}"> - + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 10b22e33a..6d6549250 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -30,6 +30,10 @@ using System.Windows.Data; using ModernWpf.Controls; using System.Drawing; using System.Windows.Forms.Design.Behavior; +using System.Security.Cryptography; +using System.Runtime.CompilerServices; +using Microsoft.VisualBasic.Devices; +using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames; namespace Flow.Launcher { @@ -105,7 +109,6 @@ namespace Flow.Launcher // since the default main window visibility is visible // so we need set focus during startup QueryTextBox.Focus(); - _viewModel.PropertyChanged += (o, e) => { switch (e.PropertyName) @@ -243,7 +246,9 @@ namespace Flow.Launcher Icon = Properties.Resources.app, Visible = !_settings.HideNotifyIcon }; + contextMenu = new ContextMenu(); + var openIcon = new FontIcon { Glyph = "\ue71e" }; var open = new MenuItem { @@ -280,9 +285,11 @@ namespace Flow.Launcher positionreset.Click += (o, e) => PositionReset(); settings.Click += (o, e) => App.API.OpenSettingDialog(); exit.Click += (o, e) => Close(); - contextMenu.Items.Add(open); + gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip"); positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip"); + + contextMenu.Items.Add(open); contextMenu.Items.Add(gamemode); contextMenu.Items.Add(positionreset); contextMenu.Items.Add(settings); @@ -359,11 +366,14 @@ namespace Flow.Launcher _animating = true; UpdatePosition(); - Storyboard sb = new Storyboard(); + + Storyboard windowsb = new Storyboard(); + Storyboard clocksb = new Storyboard(); Storyboard iconsb = new Storyboard(); - CircleEase easing = new CircleEase(); // or whatever easing class you want + CircleEase easing = new CircleEase(); easing.EasingMode = EasingMode.EaseInOut; - var da = new DoubleAnimation + + var WindowOpacity = new DoubleAnimation { From = 0, To = 1, @@ -371,33 +381,76 @@ namespace Flow.Launcher FillBehavior = FillBehavior.Stop }; - var da2 = new DoubleAnimation + var WindowMotion = new DoubleAnimation { From = Top + 10, To = Top, Duration = TimeSpan.FromSeconds(0.25), FillBehavior = FillBehavior.Stop }; - var da3 = new DoubleAnimation - { + var IconMotion = new DoubleAnimation + { From = 12, To = 0, EasingFunction = easing, Duration = TimeSpan.FromSeconds(0.36), FillBehavior = FillBehavior.Stop - }; - Storyboard.SetTarget(da, this); - Storyboard.SetTargetProperty(da, new PropertyPath(Window.OpacityProperty)); - Storyboard.SetTargetProperty(da2, new PropertyPath(Window.TopProperty)); - Storyboard.SetTargetProperty(da3, new PropertyPath(TopProperty)); - sb.Children.Add(da); - sb.Children.Add(da2); - iconsb.Children.Add(da3); - sb.Completed += (_, _) => _animating = false; + }; + + var ClockOpacity = new DoubleAnimation + { + From = 0, + To = 1, + EasingFunction = easing, + Duration = TimeSpan.FromSeconds(0.36), + FillBehavior = FillBehavior.Stop + }; + double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style + var IconOpacity = new DoubleAnimation + { + From = 0, + To = TargetIconOpacity, + EasingFunction = easing, + Duration = TimeSpan.FromSeconds(0.36), + FillBehavior = FillBehavior.Stop + }; + + double right = ClockPanel.Margin.Right; + var thicknessAnimation = new ThicknessAnimation + { + From = new Thickness(0, 12, right, 0), + To = new Thickness(0, 0, right, 0), + EasingFunction = easing, + Duration = TimeSpan.FromSeconds(0.36), + FillBehavior = FillBehavior.Stop + }; + + Storyboard.SetTargetProperty(ClockOpacity, new PropertyPath(OpacityProperty)); + Storyboard.SetTargetName(thicknessAnimation, "ClockPanel"); + Storyboard.SetTargetProperty(thicknessAnimation, new PropertyPath(MarginProperty)); + Storyboard.SetTarget(WindowOpacity, this); + Storyboard.SetTargetProperty(WindowOpacity, new PropertyPath(Window.OpacityProperty)); + Storyboard.SetTargetProperty(WindowMotion, new PropertyPath(Window.TopProperty)); + Storyboard.SetTargetProperty(IconMotion, new PropertyPath(TopProperty)); + Storyboard.SetTargetProperty(IconOpacity, new PropertyPath(OpacityProperty)); + + clocksb.Children.Add(thicknessAnimation); + clocksb.Children.Add(ClockOpacity); + windowsb.Children.Add(WindowOpacity); + windowsb.Children.Add(WindowMotion); + iconsb.Children.Add(IconMotion); + iconsb.Children.Add(IconOpacity); + + windowsb.Completed += (_, _) => _animating = false; _settings.WindowLeft = Left; _settings.WindowTop = Top; + + if (QueryTextBox.Text.Length == 0) + { + clocksb.Begin(ClockPanel); + } iconsb.Begin(SearchIcon); - sb.Begin(FlowMainWindow); + windowsb.Begin(FlowMainWindow); } private void OnMouseDown(object sender, MouseButtonEventArgs e) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 5584983a9..c3473a167 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -39,6 +39,7 @@ + @@ -1815,13 +1816,25 @@ - - - + + + + + SelectedItem="{Binding TimeFormat}" /> + Style="{DynamicResource SideToggleSwitch}" />  @@ -2200,6 +2217,12 @@ Grid.Row="0" Grid.Column="2" Orientation="Horizontal"> + + SelectedItem="{Binding DateFormat}" /> + Style="{DynamicResource SideToggleSwitch}" />  diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 0100c31d1..9ceb9789d 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -10,17 +10,14 @@ using Flow.Launcher.ViewModel; using ModernWpf; using ModernWpf.Controls; using System; -using System.Drawing.Printing; using System.IO; using System.Windows; -using System.Windows.Controls.Primitives; 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 static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; using Button = System.Windows.Controls.Button; using Control = System.Windows.Controls.Control; using KeyEventArgs = System.Windows.Input.KeyEventArgs; @@ -44,6 +41,7 @@ namespace Flow.Launcher API = api; InitializePosition(); InitializeComponent(); + } #region General @@ -64,7 +62,6 @@ namespace Flow.Launcher pluginStoreView.Filter = PluginStoreFilter; InitializePosition(); - ClockDisplay(); } private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e) @@ -514,34 +511,6 @@ namespace Flow.Launcher } } - private void PreviewClockAndDate(object sender, RoutedEventArgs e) - { - ClockDisplay(); - } - - public void ClockDisplay() - { - if (settings.UseClock) - { - ClockBox.Visibility = Visibility.Visible; - ClockBox.Text = DateTime.Now.ToString(settings.TimeFormat); - } - else - { - ClockBox.Visibility = Visibility.Collapsed; - } - - if (settings.UseDate) - { - DateBox.Visibility = Visibility.Visible; - DateBox.Text = DateTime.Now.ToString(settings.DateFormat); - } - else - { - DateBox.Visibility = Visibility.Collapsed; - } - } - public void InitializePosition() { if (settings.SettingWindowTop >= 0 && settings.SettingWindowLeft >= 0) @@ -556,6 +525,7 @@ namespace Flow.Launcher } WindowState = settings.SettingWindowState; } + public double WindowLeft() { var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 19a285f9e..82285ab69 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -100,29 +100,39 @@ - @@ -397,6 +396,12 @@ + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index 7e1ae911a..c5f701c46 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -123,6 +123,7 @@ x:Key="DateBox" BasedOn="{StaticResource BaseDateBox}" TargetType="{x:Type TextBlock}"> + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Win10Light.xaml b/Flow.Launcher/Themes/Win10Light.xaml index ad16f390e..6a4a07c56 100644 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ b/Flow.Launcher/Themes/Win10Light.xaml @@ -159,12 +159,12 @@ x:Key="ClockBox" BasedOn="{StaticResource BaseClockBox}" TargetType="{x:Type TextBlock}"> - + diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index 4c58681d7..7f8d5bc67 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -175,6 +175,7 @@ BasedOn="{StaticResource BaseClockBox}" TargetType="{x:Type TextBlock}"> +