mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-30 09:06:32 +13:00
Shutdown immediately when configuration path is empty
This commit is contained in:
parent
7d4c40a71e
commit
0fb1a086bb
3 changed files with 35 additions and 31 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2022-2022 Peter Kirmeier -->
|
||||
<!-- Copyright (c) 2022-2023 Peter Kirmeier -->
|
||||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SystemTrayMenu.UserInterface"
|
||||
x:Class="SystemTrayMenu.UserInterface.TaskbarLogo"
|
||||
mc:Ignorable="d" WindowStyle="None" ResizeMode="NoResize" Width="38" Height="38" Topmost="True" Background="Transparent" AllowsTransparency="True">
|
||||
<Image x:Name="ImagePictureBox" Width="32" Height="32" Margin="3"/>
|
||||
|
|
Loading…
Reference in a new issue