mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Added Peripherals Panel to main window (buttons have no function yet... coming soon)
This commit is contained in:
18
app/Properties/Strings.Designer.cs
generated
18
app/Properties/Strings.Designer.cs
generated
@@ -916,6 +916,15 @@ namespace GHelper.Properties {
|
||||
return ResourceManager.GetString("NoNewUpdates", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Not Connected ähnelt.
|
||||
/// </summary>
|
||||
internal static string NotConnected {
|
||||
get {
|
||||
return ResourceManager.GetString("NotConnected", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Open G-Helper window.
|
||||
@@ -980,6 +989,15 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Peripherals ähnelt.
|
||||
/// </summary>
|
||||
internal static string Peripherals {
|
||||
get {
|
||||
return ResourceManager.GetString("Peripherals", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Picture / Gif.
|
||||
/// </summary>
|
||||
|
||||
@@ -404,6 +404,9 @@ Do you still want to continue?</value>
|
||||
<data name="NoNewUpdates" xml:space="preserve">
|
||||
<value>No new updates</value>
|
||||
</data>
|
||||
<data name="NotConnected" xml:space="preserve">
|
||||
<value>Not Connected</value>
|
||||
</data>
|
||||
<data name="OpenGHelper" xml:space="preserve">
|
||||
<value>Open G-Helper window</value>
|
||||
</data>
|
||||
@@ -425,6 +428,9 @@ Do you still want to continue?</value>
|
||||
<data name="PerformanceMode" xml:space="preserve">
|
||||
<value>Mode</value>
|
||||
</data>
|
||||
<data name="Peripherals" xml:space="preserve">
|
||||
<value>Peripherals</value>
|
||||
</data>
|
||||
<data name="PictureGif" xml:space="preserve">
|
||||
<value>Picture / Gif</value>
|
||||
</data>
|
||||
|
||||
561
app/Settings.Designer.cs
generated
561
app/Settings.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,8 @@ using GHelper.Gpu;
|
||||
using GHelper.Helpers;
|
||||
using GHelper.Input;
|
||||
using GHelper.Mode;
|
||||
using GHelper.Peripherals;
|
||||
using GHelper.Peripherals.Mouse;
|
||||
using GHelper.UI;
|
||||
using System.Diagnostics;
|
||||
using System.Timers;
|
||||
@@ -71,6 +73,7 @@ namespace GHelper
|
||||
labelKeyboard.Text = Properties.Strings.LaptopKeyboard;
|
||||
labelMatrix.Text = Properties.Strings.AnimeMatrix;
|
||||
labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit;
|
||||
labelPeripherals.Text = Properties.Strings.Peripherals;
|
||||
|
||||
checkMatrix.Text = Properties.Strings.TurnOffOnBattery;
|
||||
checkStartup.Text = Properties.Strings.RunOnStartup;
|
||||
@@ -182,6 +185,10 @@ namespace GHelper
|
||||
labelBattery.MouseLeave += PanelBattery_MouseLeave;
|
||||
labelBatteryTitle.MouseLeave += PanelBattery_MouseLeave;
|
||||
|
||||
buttonPeripheral1.Click += ButtonPeripheral_Click;
|
||||
buttonPeripheral2.Click += ButtonPeripheral_Click;
|
||||
buttonPeripheral3.Click += ButtonPeripheral_Click;
|
||||
|
||||
labelModel.Text = AppConfig.GetModelShort() + (ProcessHelper.IsUserAdministrator() ? "." : "");
|
||||
TopMost = AppConfig.Is("topmost");
|
||||
|
||||
@@ -816,6 +823,7 @@ namespace GHelper
|
||||
gpuTemp = $": {HardwareControl.gpuTemp}°C";
|
||||
}
|
||||
|
||||
PeripheralsProvider.RefreshBatteryForAllDevices();
|
||||
|
||||
Program.settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
@@ -825,6 +833,7 @@ namespace GHelper
|
||||
labelMidFan.Text = "Mid " + HardwareControl.midFan;
|
||||
|
||||
if (!batteryMouseOver) labelBattery.Text = battery;
|
||||
VisualizePeripherals();
|
||||
});
|
||||
|
||||
string trayTip = "CPU" + cpuTemp + " " + HardwareControl.cpuFan;
|
||||
@@ -1056,6 +1065,66 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
public void VisualizePeripherals()
|
||||
{
|
||||
if (!PeripheralsProvider.IsAnyPeripheralConnect())
|
||||
{
|
||||
panelPeripherals.Visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Button[] buttons = new Button[] { buttonPeripheral1, buttonPeripheral2, buttonPeripheral3 };
|
||||
|
||||
//we only support 4 devces for now. Who has more than 4 mice connected to the same PC anyways....
|
||||
List<IPeripheral> lp = PeripheralsProvider.AllPeripherals();
|
||||
|
||||
for (int i = 0; i < lp.Count && i < buttons.Length; ++i)
|
||||
{
|
||||
IPeripheral m = lp.ElementAt(i);
|
||||
Button b = buttons[i];
|
||||
|
||||
if (m.IsDeviceReady)
|
||||
{
|
||||
b.Text = m.GetDisplayName() + "\n" + m.Battery + "%"
|
||||
+ (m.Charging ? "(" + Properties.Strings.Charging + ")" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Mouse is either not connected or in standby
|
||||
b.Text = m.GetDisplayName() + "\n(" + Properties.Strings.NotConnected + ")";
|
||||
}
|
||||
|
||||
switch (m.DeviceType())
|
||||
{
|
||||
case PeripheralType.Mouse:
|
||||
b.Image = ControlHelper.TintImage(Properties.Resources.icons8_maus_32, b.ForeColor);
|
||||
break;
|
||||
|
||||
case PeripheralType.Keyboard:
|
||||
b.Image = ControlHelper.TintImage(Properties.Resources.icons8_keyboard_32, b.ForeColor);
|
||||
break;
|
||||
}
|
||||
|
||||
b.Visible = true;
|
||||
}
|
||||
|
||||
for (int i = lp.Count; i < buttons.Length; ++i)
|
||||
{
|
||||
buttons[i].Visible = false;
|
||||
}
|
||||
|
||||
panelPeripherals.Visible = true;
|
||||
}
|
||||
|
||||
private void ButtonPeripheral_Click(object? sender, EventArgs e)
|
||||
{
|
||||
int index = 0;
|
||||
if (sender == buttonPeripheral2) index = 1;
|
||||
if (sender == buttonPeripheral3) index = 2;
|
||||
|
||||
//TODO: Open Configuration Panel
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user