1
0
mirror of https://github.com/DarthAffe/RGBSyncPlus synced 2025-12-12 17:08:31 +00:00

Added config-entry to disable try-minimization.

This fixes #11
This commit is contained in:
Darth Affe 2018-12-02 13:52:03 +01:00
parent bd5267b2ca
commit a4e72347a0
5 changed files with 31 additions and 2 deletions

View File

@ -1,2 +1,4 @@
# RGBSyncPlus
Tool to syncronize RGB devices
If you've issues with the configuration window not opening when clicking the Tray-Icon you can disable Tray-Minimization by changing ```"MinimizeToTray":true``` to ```"MinimizeToTray":false``` in _Settings.json_ in the installation directory. (If this entry isn't already included delete the file and start/close the program once.)

View File

@ -55,6 +55,12 @@ namespace RGBSyncPlus
ApplicationManager.Instance.Settings = settings;
ApplicationManager.Instance.Initialize();
if (!settings.MinimizeToTray) //HACK DarthAffe 02.12.2018: Workaround to create the window
{
ApplicationManager.Instance.OpenConfigurationCommand.Execute(null);
ApplicationManager.Instance.HideConfigurationCommand.Execute(null);
}
}
catch (Exception ex)
{

View File

@ -39,6 +39,9 @@ namespace RGBSyncPlus
private ActionCommand _openConfiguration;
public ActionCommand OpenConfigurationCommand => _openConfiguration ?? (_openConfiguration = new ActionCommand(OpenConfiguration));
private ActionCommand _hideConfiguration;
public ActionCommand HideConfigurationCommand => _hideConfiguration ?? (_hideConfiguration = new ActionCommand(HideConfiguration));
private ActionCommand _exitCommand;
public ActionCommand ExitCommand => _exitCommand ?? (_exitCommand = new ActionCommand(Exit));
@ -133,10 +136,26 @@ namespace RGBSyncPlus
}
}
private void HideConfiguration()
{
if (Settings.MinimizeToTray)
{
if (_configurationWindow.IsVisible)
_configurationWindow.Hide();
}
else
_configurationWindow.WindowState = WindowState.Minimized;
}
private void OpenConfiguration()
{
if (_configurationWindow == null) _configurationWindow = new ConfigurationWindow();
if (!_configurationWindow.IsVisible)
_configurationWindow.Show();
if (_configurationWindow.WindowState == WindowState.Minimized)
_configurationWindow.WindowState = WindowState.Normal;
}
private void Exit()

View File

@ -17,6 +17,8 @@ namespace RGBSyncPlus.Configuration
public double UpdateRate { get; set; } = 30.0;
public bool MinimizeToTray { get; set; } = true;
public List<SyncGroup> SyncGroups { get; set; } = new List<SyncGroup>();
#endregion

View File

@ -76,7 +76,7 @@ namespace RGBSyncPlus.Controls
closeButton.Click += (sender, args) => ApplicationManager.Instance.ExitCommand.Execute(null);
if (GetTemplateChild("PART_MinimizeButton") is Button minimizeButton)
minimizeButton.Click += (sender, args) => Hide();
minimizeButton.Click += (sender, args) => ApplicationManager.Instance.HideConfigurationCommand.Execute(null); //HACK DarthAffe 02.12.2018: This is a really dirty hack - hopefully this will never get more than one window ...
if (GetTemplateChild("PART_IconButton") is Button iconButton)
iconButton.Click += (sender, args) => IconCommand?.Execute(null);