diff --git a/Business/Menus.cs b/Business/Menus.cs index 7fa40db..a7b5648 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -243,42 +243,37 @@ namespace SystemTrayMenu.Business } waitToOpenMenu.MouseActive = byClick; - if (string.IsNullOrEmpty(Config.Path)) + + if (openCloseState == OpenCloseState.Opening || + (openCloseState == OpenCloseState.Default && (mainMenu?.Visibility ?? Visibility.Collapsed) == Visibility.Visible)) { - // Case when Folder Dialog open + openCloseState = OpenCloseState.Closing; + + MenusFadeOut(); + + if (workerMainMenu.IsBusy) + { + workerMainMenu.CancelAsync(); + } + + if (IsVisibleAnyMenu(mainMenu) == null) + { + openCloseState = OpenCloseState.Default; + } } else { - if (openCloseState == OpenCloseState.Opening || - ((mainMenu?.Visibility ?? Visibility.Collapsed) == Visibility.Visible && openCloseState == OpenCloseState.Default)) + openCloseState = OpenCloseState.Opening; + + if (Settings.Default.GenerateShortcutsToDrives) { - openCloseState = OpenCloseState.Closing; - MenusFadeOut(); - - if (workerMainMenu.IsBusy) - { - workerMainMenu.CancelAsync(); - } - - if (IsVisibleAnyMenu(mainMenu) == null) - { - openCloseState = OpenCloseState.Default; - } + GenerateDriveShortcuts.Start(); } - else + + if (!workerMainMenu.IsBusy) { - openCloseState = OpenCloseState.Opening; - - if (Settings.Default.GenerateShortcutsToDrives) - { - GenerateDriveShortcuts.Start(); - } - - if (!workerMainMenu.IsBusy) - { - LoadStarted?.Invoke(); - workerMainMenu.RunWorkerAsync(null); - } + LoadStarted?.Invoke(); + workerMainMenu.RunWorkerAsync(null); } } } diff --git a/Business/Program.cs b/Business/Program.cs index b9b0194..cffbde5 100644 --- a/Business/Program.cs +++ b/Business/Program.cs @@ -24,6 +24,16 @@ namespace SystemTrayMenu Config.LoadOrSetByUser(); Config.Initialize(); + // Without a valid path we cannot do anything, just close application + if (string.IsNullOrEmpty(Config.Path)) + { + MessageBox.Show( + Translator.GetText("Your root directory for the app does not exist or is empty! Change the root directory or put some files, directories or shortcuts into the root directory."), + "SystemTrayMenu", + MessageBoxButton.OK); + return; + } + if (SingleAppInstance.Initialize()) { AppDomain currentDomain = AppDomain.CurrentDomain; diff --git a/UserInterface/TaskbarLogo.xaml b/UserInterface/TaskbarLogo.xaml index e4aaf3a..9a9d0f1 100644 --- a/UserInterface/TaskbarLogo.xaml +++ b/UserInterface/TaskbarLogo.xaml @@ -1,10 +1,9 @@  - +