From a2600af2eb4d5af78106dd60b88c5af1d755724b Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 14 Nov 2021 17:45:56 +0900 Subject: [PATCH] - Add Show() function and seperate toggleflow() - Change ShowMainWindow to using Show() (for Fix plugin install button) --- Flow.Launcher/PublicAPIInstance.cs | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 1 - Flow.Launcher/ViewModel/MainViewModel.cs | 25 ++++++++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index e90a53fc3..a5c9f3afe 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -70,7 +70,7 @@ namespace Flow.Launcher public void RestarApp() => RestartApp(); - public void ShowMainWindow() => _mainVM.MainWindowVisibility = Visibility.Visible; + public void ShowMainWindow() => _mainVM.Show(); public void CheckForNewUpdate() => _settingsVM.UpdateApp(); diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 054274eb6..88d4f2895 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -15,7 +15,6 @@ using Flow.Launcher.ViewModel; using Flow.Launcher.Helper; using System.Windows.Controls; using Flow.Launcher.Core.ExternalPlugins; -using Screen = System.Windows.Forms.Screen; namespace Flow.Launcher { diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 6e1befeaf..9870053c2 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -713,16 +713,7 @@ 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(); - MainWindowOpacity = 1; + Show(); } else { @@ -730,6 +721,20 @@ namespace Flow.Launcher.ViewModel } } + public void Show() + { + 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(); + MainWindowOpacity = 1; + } + public async void Hide() { MainWindowOpacity = 0;