mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Only open one Mouse settings window and also make it the topmost window.
This commit is contained in:
@@ -25,6 +25,8 @@ namespace GHelper
|
|||||||
ScreenControl screenControl = new ScreenControl();
|
ScreenControl screenControl = new ScreenControl();
|
||||||
AutoUpdateControl updateControl;
|
AutoUpdateControl updateControl;
|
||||||
|
|
||||||
|
AsusMouseSettings? mouseSettings;
|
||||||
|
|
||||||
public AniMatrixControl matrix;
|
public AniMatrixControl matrix;
|
||||||
|
|
||||||
public static System.Timers.Timer sensorTimer = default!;
|
public static System.Timers.Timer sensorTimer = default!;
|
||||||
@@ -1187,6 +1189,12 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ButtonPeripheral_Click(object? sender, EventArgs e)
|
private void ButtonPeripheral_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (mouseSettings is not null)
|
||||||
|
{
|
||||||
|
mouseSettings.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if (sender == buttonPeripheral2) index = 1;
|
if (sender == buttonPeripheral2) index = 1;
|
||||||
if (sender == buttonPeripheral3) index = 2;
|
if (sender == buttonPeripheral3) index = 2;
|
||||||
@@ -1207,16 +1215,30 @@ namespace GHelper
|
|||||||
//Should not happen if all device classes are implemented correctly. But better safe than sorry.
|
//Should not happen if all device classes are implemented correctly. But better safe than sorry.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AsusMouseSettings s = new AsusMouseSettings(am);
|
mouseSettings = new AsusMouseSettings(am);
|
||||||
if (!s.IsDisposed)
|
mouseSettings.TopMost = true;
|
||||||
|
mouseSettings.FormClosed += MouseSettings_FormClosed;
|
||||||
|
mouseSettings.Disposed += MouseSettings_Disposed;
|
||||||
|
if (!mouseSettings.IsDisposed)
|
||||||
{
|
{
|
||||||
s.Show();
|
mouseSettings.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mouseSettings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MouseSettings_Disposed(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
mouseSettings = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MouseSettings_FormClosed(object? sender, FormClosedEventArgs e)
|
||||||
|
{
|
||||||
|
mouseSettings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void VisualiseFnLock()
|
public void VisualiseFnLock()
|
||||||
|
|||||||
Reference in New Issue
Block a user