mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-20 19:30:31 +12:00
This commit is contained in:
parent
401e1329f1
commit
db46db002d
|
@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0.2")]
|
||||
[assembly: AssemblyFileVersion("1.2.0.2")]
|
||||
[assembly: AssemblyVersion("1.2.0.4")]
|
||||
[assembly: AssemblyFileVersion("1.2.0.4")]
|
||||
|
|
|
@ -28,15 +28,8 @@ namespace SystemTrayMenu.Helper
|
|||
ImageScaling = ToolStripItemImageScaling.SizeToFit,
|
||||
Text = Translator.GetText("Settings"),
|
||||
};
|
||||
settings.Click += Settings_Click;
|
||||
static void Settings_Click(object sender, EventArgs e)
|
||||
{
|
||||
SettingsForm settingsForm = new();
|
||||
if (settingsForm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
AppRestart.ByConfigChange();
|
||||
}
|
||||
}
|
||||
|
||||
settings.Click += (sender, e) => SettingsForm.ShowSingleInstance();
|
||||
|
||||
menu.Items.Add(settings);
|
||||
|
||||
|
|
|
@ -893,11 +893,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
SettingsForm settingsForm = new();
|
||||
if (settingsForm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
AppRestart.ByConfigChange();
|
||||
}
|
||||
SettingsForm.ShowSingleInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -987,6 +983,13 @@ namespace SystemTrayMenu.UserInterface
|
|||
private void Menu_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
mouseDown = false;
|
||||
if (Properties.Settings.Default.UseCustomLocation)
|
||||
{
|
||||
if (!SettingsForm.IsOpen())
|
||||
{
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
private const string Command = @"Software\Classes\directory\shell\SystemTrayMenu_SetAsRootFolder\command";
|
||||
|
||||
private static readonly Icon SystemTrayMenu = Resources.SystemTrayMenu;
|
||||
private static SettingsForm settingsForm;
|
||||
private readonly ColorConverter colorConverter = new();
|
||||
private bool inHotkey;
|
||||
|
||||
|
@ -441,6 +442,31 @@ namespace SystemTrayMenu.UserInterface
|
|||
textBoxColorArrowHoverBackgroundDarkMode.Text = Settings.Default.ColorArrowHoverBackgroundDarkMode;
|
||||
}
|
||||
|
||||
internal static void ShowSingleInstance()
|
||||
{
|
||||
if (IsOpen())
|
||||
{
|
||||
settingsForm.Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
using (settingsForm = new())
|
||||
{
|
||||
if (settingsForm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
AppRestart.ByConfigChange();
|
||||
}
|
||||
}
|
||||
|
||||
settingsForm = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsOpen()
|
||||
{
|
||||
return settingsForm != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets NewHotKey.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in a new issue