From 62eb1b6cff052df66a3e1540195581002187aa6c Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 14 Nov 2021 07:45:47 +0900 Subject: [PATCH] - Add Sound - Add Sound/Animation in Setting - Add related String --- .../UserSettings/Settings.cs | 3 + Flow.Launcher/Languages/en.xaml | 4 + Flow.Launcher/MainWindow.xaml.cs | 73 +++++------ Flow.Launcher/Resources/open.wav | Bin 0 -> 4784 bytes Flow.Launcher/SettingWindow.xaml | 119 ++++++++++++++---- Flow.Launcher/ViewModel/MainViewModel.cs | 7 ++ .../ViewModel/SettingWindowViewModel.cs | 12 ++ 7 files changed, 159 insertions(+), 59 deletions(-) create mode 100644 Flow.Launcher/Resources/open.wav diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 5f9082fe9..d0351af51 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -37,6 +37,9 @@ namespace Flow.Launcher.Infrastructure.UserSettings public string ResultFontStretch { get; set; } public bool UseGlyphIcons { get; set; } = true; + public bool UseAnimation { get; set; } = true; + public bool UseSound { get; set; } = false; + /// /// when false Alphabet static service will always return empty results diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 1cb203515..9721ad869 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -80,6 +80,10 @@ Fail to load theme {0}, fallback to default theme Theme Folder Open Theme Folder + Sound Effect + Play a small sound when window open. + Animation + Use Animation in UI. Hotkey diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index db38f0fad..2d8e2f822 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -238,44 +238,47 @@ namespace Flow.Launcher public void WindowAnimator() { - if (_animating) - return; + if (_settings.UseAnimation) + { + if (_animating) + return; - _animating = true; - UpdatePosition(); - Storyboard sb = new Storyboard(); - var da = new DoubleAnimation - { - From = 0, - To = 1, - Duration = TimeSpan.FromSeconds(0.2), - FillBehavior = FillBehavior.Stop - }; + _animating = true; + UpdatePosition(); + Storyboard sb = new Storyboard(); + var da = new DoubleAnimation + { + From = 0, + To = 1, + Duration = TimeSpan.FromSeconds(0.2), + FillBehavior = FillBehavior.Stop + }; - var da2 = new DoubleAnimation - { - From = Top + 8, - To = Top, - Duration = TimeSpan.FromSeconds(0.2), - FillBehavior = FillBehavior.Stop - }; + var da2 = new DoubleAnimation + { + From = Top + 8, + To = Top, + Duration = TimeSpan.FromSeconds(0.2), + FillBehavior = FillBehavior.Stop + }; - var da3 = new DoubleAnimation - { - From = Left, - To = Left, - Duration = TimeSpan.FromSeconds(0.1), - 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(Window.LeftProperty)); - sb.Children.Add(da); - sb.Children.Add(da2); - sb.Children.Add(da3); - sb.Completed += (_, _) => _animating = false; - sb.Begin(FlowMainWindow); + var da3 = new DoubleAnimation + { + From = Left, + To = Left, + Duration = TimeSpan.FromSeconds(0.1), + 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(Window.LeftProperty)); + sb.Children.Add(da); + sb.Children.Add(da2); + sb.Children.Add(da3); + sb.Completed += (_, _) => _animating = false; + sb.Begin(FlowMainWindow); + } } diff --git a/Flow.Launcher/Resources/open.wav b/Flow.Launcher/Resources/open.wav new file mode 100644 index 0000000000000000000000000000000000000000..c3e0619975cac92469bbfa0b64c66f046c2ad767 GIT binary patch liter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.Launcher/SettingWindow.xaml @@ -1388,11 +1388,15 @@ TextAlignment="left" /> - - + + @@ -1470,26 +1474,29 @@ - - + + - + @@ -1749,6 +1756,70 @@ + + + + + + + + + + + +  + + + + + + + + + + + + +  + + + + + + diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 4509d1fce..6e1befeaf 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -5,6 +5,7 @@ using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; using System.Windows; +using System.Windows.Media; using System.Windows.Input; using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Resource; @@ -712,6 +713,12 @@ namespace Flow.Launcher.ViewModel { if (WinToggleStatus != true) { + if (_settings.UseSound) + { + MediaPlayer media = new MediaPlayer(); + media.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); + media.Play(); + } MainWindowVisibility = Visibility.Visible; WinToggleStatus = true; ((MainWindow)Application.Current.MainWindow).WindowAnimator(); diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 4947ca380..773c4733c 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -328,6 +328,18 @@ namespace Flow.Launcher.ViewModel set => Settings.UseGlyphIcons = value; } + public bool UseAnimation + { + get => Settings.UseAnimation; + set => Settings.UseAnimation = value; + } + + public bool UseSound + { + get => Settings.UseSound; + set => Settings.UseSound = value; + } + public Brush PreviewBackground { get