From 1b8992d3cd2d9da40680e78d3be3e71a1e57becd Mon Sep 17 00:00:00 2001
From: project-sbc <78889381+project-sbc@users.noreply.github.com>
Date: Wed, 5 Oct 2022 12:55:45 -0400
Subject: [PATCH 01/11] add fps limit to other pages
---
.../StartUp/Resources/StringResources.xaml | 1 +
.../Resources/StringResources.zh-Hans.xaml | 1 +
PowerControlPanel/Pages/HomePage.xaml | 13 +++++++++--
PowerControlPanel/Pages/HomePage.xaml.cs | 22 +++++++++++++++++++
PowerControlPanel/Pages/SliderHomePage.xaml | 22 +++++++++++++++++++
.../Pages/SliderHomePage.xaml.cs | 21 +++++++++++++++++-
6 files changed, 77 insertions(+), 3 deletions(-)
diff --git a/PowerControlPanel/Classes/StartUp/Resources/StringResources.xaml b/PowerControlPanel/Classes/StartUp/Resources/StringResources.xaml
index fc8e075..23158e1 100644
--- a/PowerControlPanel/Classes/StartUp/Resources/StringResources.xaml
+++ b/PowerControlPanel/Classes/StartUp/Resources/StringResources.xaml
@@ -26,6 +26,7 @@
Display Resolution
Display Refresh Rate
Display Scaling (%)
+ FPS Limit
Active Profile
SYSTEM CONTROLS
diff --git a/PowerControlPanel/Classes/StartUp/Resources/StringResources.zh-Hans.xaml b/PowerControlPanel/Classes/StartUp/Resources/StringResources.zh-Hans.xaml
index 1c3534d..164dc75 100644
--- a/PowerControlPanel/Classes/StartUp/Resources/StringResources.zh-Hans.xaml
+++ b/PowerControlPanel/Classes/StartUp/Resources/StringResources.zh-Hans.xaml
@@ -27,6 +27,7 @@
显示分辨率
屏幕刷新率
显示比例
+ FPS Limit
Active Profile
diff --git a/PowerControlPanel/Pages/HomePage.xaml b/PowerControlPanel/Pages/HomePage.xaml
index 3986b6b..f035f94 100644
--- a/PowerControlPanel/Pages/HomePage.xaml
+++ b/PowerControlPanel/Pages/HomePage.xaml
@@ -234,12 +234,12 @@
-
+
-
+
+
+
+
+
+
+
+
diff --git a/PowerControlPanel/Pages/HomePage.xaml.cs b/PowerControlPanel/Pages/HomePage.xaml.cs
index 0d27a37..dce24d7 100644
--- a/PowerControlPanel/Pages/HomePage.xaml.cs
+++ b/PowerControlPanel/Pages/HomePage.xaml.cs
@@ -113,6 +113,7 @@ private void displayItemSourceBind()
cboRefreshRate.ItemsSource = GlobalVariables.refreshRates;
cboResolution.ItemsSource = GlobalVariables.resolutions;
+ cboFPSLimit.ItemsSource = GlobalVariables.FPSLimits;
changingResolution = true;
cboResolution.SelectedIndex = 0;
@@ -250,6 +251,22 @@ private void loadUpdateValues()
changingScaling = false;
}
+
+
+
+ }
+
+ if (PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.rtssRunning())
+ {
+ cboFPSLimit.Text = GlobalVariables.FPSLimit;
+
+ rdFPSLimit.Height = new GridLength(50);
+ dpFPSLimit.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ rdFPSLimit.Height = new GridLength(0);
+ dpFPSLimit.Visibility = Visibility.Collapsed;
}
//profile
@@ -893,5 +910,10 @@ private void enableControlProfile_Toggled(object sender, RoutedEventArgs e)
}
}
+
+ private void cboFPSLimit_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(cboFPSLimit.SelectedValue.ToString());
+ }
}
}
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml b/PowerControlPanel/Pages/SliderHomePage.xaml
index 270b81e..6b39c66 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml
@@ -299,7 +299,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml.cs b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
index f50657b..42afc3b 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml.cs
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
@@ -109,10 +109,12 @@ private void displayItemSourceBind()
cboRefreshRate.ItemsSource = GlobalVariables.refreshRates;
cboResolution.ItemsSource = GlobalVariables.resolutions;
+ cboFPSLimit.ItemsSource = GlobalVariables.FPSLimits;
changingResolution = true;
cboResolution.SelectedIndex = 0;
changingResolution = false;
+
}
@@ -256,6 +258,20 @@ private void loadUpdateValues()
}
}
+ if (PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.rtssRunning())
+ {
+ cboFPSLimit.Text = GlobalVariables.FPSLimit;
+
+
+ bdFPSLimit.Visibility = Visibility.Visible;
+ }
+ else
+ {
+
+ bdFPSLimit.Visibility = Visibility.Collapsed;
+ }
+
+
//system values
if (enableSystem)
{
@@ -728,6 +744,9 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
handleVisibility();
}
-
+ private void cboFPSLimit_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(cboFPSLimit.SelectedValue.ToString());
+ }
}
}
From 7c1ac0f220a384cb4e76359c1f2a151a895e5b62 Mon Sep 17 00:00:00 2001
From: project-sbc <78889381+project-sbc@users.noreply.github.com>
Date: Thu, 6 Oct 2022 06:29:55 -0400
Subject: [PATCH 02/11] fixed issue where no button combo causes crash
---
MainWindow.xaml.cs | 65 +++++++++++++++++++++++++++-------------------
1 file changed, 38 insertions(+), 27 deletions(-)
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 6e59407..d199aa9 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -288,39 +288,50 @@ private bool ButtonComboPress(Gamepad gp,string BC)
//split string into array
string[] strBC = BC.Split('+');
- //gamepad flag array
- GamepadButtonFlags[] qamButtonCombo = new GamepadButtonFlags[strBC.Length];
- int intCount = 0;
- foreach (var bc in strBC)
- {
- //for each string lookup in the dictionary for the gamepad flag
- qamButtonCombo[intCount] = buttonLookUp[bc];
- intCount++;
- }
- //set bool to true
- bool oldGamepadPress = true;
- bool GamepadPress = true;
- foreach (GamepadButtonFlags button in qamButtonCombo)
+
+ if (strBC.Length > 0)
{
- //the press scenario is defined when the old gamepad state doesn't have all buttons pressed but the new state does. This will turn the bool false if any of the buttons arent pressed
- if (!gamepad.Buttons.HasFlag(button))
+ //gamepad flag array
+ GamepadButtonFlags[] ButtonCombo = new GamepadButtonFlags[strBC.Length];
+ int intCount = 0;
+
+ foreach (var bc in strBC)
{
- oldGamepadPress = false;
+ //for each string lookup in the dictionary for the gamepad flag
+ ButtonCombo[intCount] = buttonLookUp[bc];
+ intCount++;
}
- if (!gp.Buttons.HasFlag(button))
+
+ //set bool to true
+ bool oldGamepadPress = true;
+ bool GamepadPress = true;
+ foreach (GamepadButtonFlags button in ButtonCombo)
{
- GamepadPress = false;
+ //the press scenario is defined when the old gamepad state doesn't have all buttons pressed but the new state does. This will turn the bool false if any of the buttons arent pressed
+ if (!gamepad.Buttons.HasFlag(button))
+ {
+ oldGamepadPress = false;
+ }
+ if (!gp.Buttons.HasFlag(button))
+ {
+ GamepadPress = false;
+ }
}
+ //button press is true when current gamepadpress is true and the old gamepad state is false
+ if (!oldGamepadPress && GamepadPress)
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+
+
+
}
- //button press is true when current gamepadpress is true and the old gamepad state is false
- if (!oldGamepadPress && GamepadPress)
- {
- result = true;
- }
- else
- {
- result = false;
- }
+
+
return result;
From 3c0e81b6c5b728d193d737e672596f0f6038aac1 Mon Sep 17 00:00:00 2001
From: project-sbc <78889381+project-sbc@users.noreply.github.com>
Date: Thu, 6 Oct 2022 17:52:51 -0400
Subject: [PATCH 03/11] updates
---
MainWindow.xaml.cs | 10 +++---
.../Classes/ChangeTDP/ChangeTDP.cs | 1 +
.../Classes/changeCPU/ChangeCPU.cs | 3 +-
PowerControlPanel/Pages/SliderHomePage.xaml | 16 ++++-----
.../Pages/SliderHomePage.xaml.cs | 33 +++++--------------
5 files changed, 26 insertions(+), 37 deletions(-)
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index d199aa9..3bbab38 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -69,8 +69,8 @@ public static class GlobalVariables
public static int cpuActiveCores = 0;
public static int maxCpuCores = 1;
public static int baseCPUSpeed = 1000;
-
-
+ public static bool needCPUMaxFreqRead = false;
+ public static bool needActiveCoreRead = false;
//RTSS fps limit
public static string FPSLimit = "Unlocked";
@@ -287,10 +287,12 @@ private bool ButtonComboPress(Gamepad gp,string BC)
bool result = false;
//split string into array
- string[] strBC = BC.Split('+');
+
- if (strBC.Length > 0)
+ if (BC.IndexOf("+") > 0)
{
+ string[] strBC = BC.Split('+');
+
//gamepad flag array
GamepadButtonFlags[] ButtonCombo = new GamepadButtonFlags[strBC.Length];
int intCount = 0;
diff --git a/PowerControlPanel/Classes/ChangeTDP/ChangeTDP.cs b/PowerControlPanel/Classes/ChangeTDP/ChangeTDP.cs
index c2b759a..8ff617a 100644
--- a/PowerControlPanel/Classes/ChangeTDP/ChangeTDP.cs
+++ b/PowerControlPanel/Classes/ChangeTDP/ChangeTDP.cs
@@ -117,6 +117,7 @@ public void changeTDP(int pl1TDP, int pl2TDP)
//read tdp after changing
readTDP();
+ GlobalVariables.needTDPRead = false;
}
catch (Exception ex)
{
diff --git a/PowerControlPanel/Classes/changeCPU/ChangeCPU.cs b/PowerControlPanel/Classes/changeCPU/ChangeCPU.cs
index f10364c..f54ae74 100644
--- a/PowerControlPanel/Classes/changeCPU/ChangeCPU.cs
+++ b/PowerControlPanel/Classes/changeCPU/ChangeCPU.cs
@@ -103,7 +103,7 @@ public static void changeCPUMaxFrequency(int maxCPU)
RunCLI.RunCommand(" /S scheme_current", false, "C:\\windows\\system32\\powercfg.exe", 1000);
readCPUMaxFrequency();
-
+ GlobalVariables.needCPUMaxFreqRead = false;
}
@@ -123,6 +123,7 @@ public static void changeActiveCores(double coreCount)
}
RunCLI.RunCommand(" /S scheme_current", false, "C:\\windows\\system32\\powercfg.exe", 1000);
readActiveCores();
+ GlobalVariables.needActiveCoreRead = false;
}
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml b/PowerControlPanel/Pages/SliderHomePage.xaml
index 6b39c66..8c9e055 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml
@@ -35,7 +35,7 @@
-
+
@@ -63,7 +63,7 @@
-
+
@@ -93,7 +93,7 @@
-
+
@@ -116,7 +116,7 @@
-
+
@@ -138,7 +138,7 @@
-
+
@@ -163,7 +163,7 @@
-
+
@@ -189,7 +189,7 @@
-
+
@@ -214,7 +214,7 @@
-
+
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml.cs b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
index 42afc3b..69b50f6 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml.cs
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
@@ -195,7 +195,7 @@ private void loadUpdateValues()
}
//max cpu clock updates
- if (!dragStartedMAXCPU && enableCPU)
+ if (!dragStartedMAXCPU && enableCPU && !GlobalVariables.needCPUMaxFreqRead)
{
if (GlobalVariables.cpuMaxFrequency == 0)
{
@@ -216,11 +216,9 @@ private void loadUpdateValues()
//active core updates
- if (!dragStartedActiveCores && enableCPU)
+ if (!dragStartedActiveCores && enableCPU && !GlobalVariables.needActiveCoreRead)
{
-
ActiveCores.Value = GlobalVariables.cpuActiveCores;
-
}
//profile
@@ -330,7 +328,7 @@ private void handleVisibility()
#endregion
#region slider value changed
- private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ private void Slider_MouseUp(object sender, MouseButtonEventArgs e)
{
Slider slider = sender as Slider;
@@ -344,6 +342,7 @@ private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs
Date: Thu, 6 Oct 2022 18:59:36 -0400
Subject: [PATCH 04/11] updates
---
PowerControlPanel/Pages/HomePage.xaml.cs | 12 +-
PowerControlPanel/Pages/SliderHomePage.xaml | 79 ++-------
.../Pages/SliderHomePage.xaml.cs | 154 +++++++++---------
3 files changed, 100 insertions(+), 145 deletions(-)
diff --git a/PowerControlPanel/Pages/HomePage.xaml.cs b/PowerControlPanel/Pages/HomePage.xaml.cs
index dce24d7..b83518e 100644
--- a/PowerControlPanel/Pages/HomePage.xaml.cs
+++ b/PowerControlPanel/Pages/HomePage.xaml.cs
@@ -74,6 +74,12 @@ public HomePage()
InitializeComponent();
//set max cpu core count here
+ //hide items
+ if (GlobalVariables.cpuType != "AMD")
+ {
+ GBAMDGPUCLK.Visibility = Visibility.Collapsed;
+ }
+
initializeTimer();
setMinMaxSliderValues();
@@ -198,7 +204,7 @@ private void loadUpdateValues()
}
//max cpu clock updates
- if (!dragStartedMAXCPU && enableCPU)
+ if (!dragStartedMAXCPU && enableCPU && GlobalVariables.needCPUMaxFreqRead == false)
{
if (GlobalVariables.cpuMaxFrequency == 0)
{
@@ -219,7 +225,7 @@ private void loadUpdateValues()
//active core updates
- if (!dragStartedActiveCores && enableCPU)
+ if (!dragStartedActiveCores && enableCPU && GlobalVariables.needActiveCoreRead == false)
{
changingActiveCores = true;
ActiveCores.Value = GlobalVariables.cpuActiveCores;
@@ -787,6 +793,7 @@ private void HandleChangingMAXCPU(int maxcpu)
if(dragStartedMAXCPU == false)
{
changingMAXCPU = true;
+ GlobalVariables.needCPUMaxFreqRead = true;
int sendMaxCPU = 0;
if (maxcpu != MAXCPU.Maximum) { sendMaxCPU = maxcpu; }
@@ -809,6 +816,7 @@ private void HandleChangingActiveCores(double cores)
if (dragStartedActiveCores == false && !changingActiveCores)
{
changingActiveCores = true;
+ GlobalVariables.needActiveCoreRead = true;
Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.changeCPU.ChangeCPU.changeActiveCores(cores));
changingActiveCores = false;
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml b/PowerControlPanel/Pages/SliderHomePage.xaml
index 8c9e055..403c021 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml
@@ -32,138 +32,82 @@
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
-
-
-
+
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+
-
-
+
-
-
+
@@ -189,9 +133,8 @@
-
+
-
@@ -214,7 +157,7 @@
-
+
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml.cs b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
index 69b50f6..5520502 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml.cs
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
@@ -330,80 +330,7 @@ private void handleVisibility()
#region slider value changed
private void Slider_MouseUp(object sender, MouseButtonEventArgs e)
{
- Slider slider = sender as Slider;
-
- string sliderName = slider.Name;
-
- if (this.IsLoaded)
- {
- Debug.WriteLine("value changed event");
- switch (sliderName)
- {
- case "TDP1":
- if (!dragStartedTDP1 && !changingTDP)
- {
- //Debug.WriteLine(TDP1.Value.ToString());
- HandleChangingTDP((int)TDP1.Value, (int)TDP2.Value, true);
- }
- break;
- case "TDP":
- if (!dragStartedTDP && !changingTDP)
- {
- HandleChangingTDP((int)TDP.Value, (int)TDP.Value, true);
- }
- break;
- case "TDP2":
- if (!dragStartedTDP2 && !changingTDP)
- {
- HandleChangingTDP((int)TDP1.Value, (int)TDP2.Value, false);
- }
- break;
- case "Brightness":
- if (!dragStartedBrightness)
- {
- HandleChangingBrightness(Brightness.Value);
- }
- break;
-
- case "Volume":
- if (!dragStartedVolume)
- {
- HandleChangingVolume((int)Volume.Value);
- }
- break;
- case "GPUCLK":
- if (!dragStartedGPUCLK && !changingGPUCLK)
- {
- HandleChangingGPUCLK((int)GPUCLK.Value);
- }
- break;
- case "MAXCPU":
- if (!dragStartedMAXCPU && !changingMAXCPU)
- {
- HandleChangingMAXCPU((int)MAXCPU.Value);
- }
- if (MAXCPU.Value == MAXCPU.Maximum)
- {
- txtsliderMAXCPU.Visibility = Visibility.Collapsed;
- txtsliderMAXCPUAuto.Visibility = Visibility.Visible;
- }
- else
- {
- txtsliderMAXCPUAuto.Visibility = Visibility.Collapsed;
- txtsliderMAXCPU.Visibility = Visibility.Visible;
- }
- break;
- case "ActiveCores":
- if (!dragStartedActiveCores && !changingActiveCores)
- {
- HandleChangingActiveCores(Convert.ToDouble(ActiveCores.Value));
- }
- break;
- default:
- break;
- }
-
- }
+
}
#endregion
@@ -654,6 +581,7 @@ private void HandleChangingActiveCores(double cores)
if (dragStartedActiveCores == false)
{
changingActiveCores = true;
+ GlobalVariables.needActiveCoreRead = true;
Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.changeCPU.ChangeCPU.changeActiveCores(cores));
changingActiveCores = false;
@@ -732,6 +660,82 @@ private void cboFPSLimit_SelectionChanged(object sender, SelectionChangedEventAr
PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(cboFPSLimit.SelectedValue.ToString());
}
-
+ private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ Slider slider = sender as Slider;
+
+ string sliderName = slider.Name;
+
+ if (this.IsLoaded)
+ {
+ Debug.WriteLine("value changed event");
+ switch (sliderName)
+ {
+ case "TDP1":
+ if (!dragStartedTDP1 && !changingTDP)
+ {
+ //Debug.WriteLine(TDP1.Value.ToString());
+ HandleChangingTDP((int)TDP1.Value, (int)TDP2.Value, true);
+ }
+ break;
+ case "TDP":
+ if (!dragStartedTDP && !changingTDP)
+ {
+ HandleChangingTDP((int)TDP.Value, (int)TDP.Value, true);
+ }
+ break;
+ case "TDP2":
+ if (!dragStartedTDP2 && !changingTDP)
+ {
+ HandleChangingTDP((int)TDP1.Value, (int)TDP2.Value, false);
+ }
+ break;
+ case "Brightness":
+ if (!dragStartedBrightness)
+ {
+ HandleChangingBrightness(Brightness.Value);
+ }
+ break;
+
+ case "Volume":
+ if (!dragStartedVolume)
+ {
+ HandleChangingVolume((int)Volume.Value);
+ }
+ break;
+ case "GPUCLK":
+ if (!dragStartedGPUCLK && !changingGPUCLK)
+ {
+ HandleChangingGPUCLK((int)GPUCLK.Value);
+ }
+ break;
+ case "MAXCPU":
+ if (!dragStartedMAXCPU && !changingMAXCPU)
+ {
+ HandleChangingMAXCPU((int)MAXCPU.Value);
+ }
+ if (MAXCPU.Value == MAXCPU.Maximum)
+ {
+ txtsliderMAXCPU.Visibility = Visibility.Collapsed;
+ txtsliderMAXCPUAuto.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ txtsliderMAXCPUAuto.Visibility = Visibility.Collapsed;
+ txtsliderMAXCPU.Visibility = Visibility.Visible;
+ }
+ break;
+ case "ActiveCores":
+ if (!dragStartedActiveCores && !changingActiveCores)
+ {
+ HandleChangingActiveCores(Convert.ToDouble(ActiveCores.Value));
+ }
+ break;
+ default:
+ break;
+ }
+
+ }
+ }
}
}
From b39d01db58a2593a7c0997bdcc9337a2043e1a0e Mon Sep 17 00:00:00 2001
From: project-sbc <78889381+project-sbc@users.noreply.github.com>
Date: Fri, 7 Oct 2022 16:05:34 -0400
Subject: [PATCH 05/11] playnite implementation
---
MainWindow.xaml.cs | 8 +++-
.../Classes/Playnite/Playnite.cs | 47 ++++++++++++++++++
PowerControlPanel/Classes/RunCLI/RunCLI.cs | 5 +-
PowerControlPanel/Classes/StartUp/StartUp.cs | 5 ++
.../TaskSchedulerWin32/TaskSchedulerWin32.cs | 48 +++++++++++++++++++
PowerControlPanel/Pages/HomePage.xaml | 8 +---
PowerControlPanel/Pages/HomePage.xaml.cs | 8 ++--
PowerControlPanel/Pages/SettingsPage.xaml.cs | 38 +--------------
PowerControlPanel/Pages/SliderHomePage.xaml | 8 +---
.../Pages/SliderHomePage.xaml.cs | 6 +--
Properties/Settings.Designer.cs | 12 +++++
Properties/Settings.settings | 3 ++
12 files changed, 135 insertions(+), 61 deletions(-)
create mode 100644 PowerControlPanel/Classes/Playnite/Playnite.cs
create mode 100644 PowerControlPanel/Classes/TaskSchedulerWin32/TaskSchedulerWin32.cs
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 3bbab38..5a1f602 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -167,7 +167,9 @@ public MainWindow()
_ = Tablet.TabletDevices;
//test code here
-
+ //RunCLI.RunCommand(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile + ""));
+ //System.Windows.Forms.MessageBox.Show(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "\\Playnite\\Playnite.FullscreenApp.exe --start"));
+
}
private void setUpNotifyIcon()
@@ -372,6 +374,10 @@ private void timerTick(object sender, EventArgs e)
{
PowerControlPanel.Classes.EnableFSR.EnableFSR.enableDisableFSR();
}
+ if (ButtonComboPress(currentGamepad, Properties.Settings.Default.playniteButtonCombo))
+ {
+ PowerControlPanel.Classes.Playnite.Playnite.playniteToggle();
+ }
//set currentgamepad snapshot to global gamepad for comparison
gamepad = currentGamepad;
diff --git a/PowerControlPanel/Classes/Playnite/Playnite.cs b/PowerControlPanel/Classes/Playnite/Playnite.cs
new file mode 100644
index 0000000..7c81b8c
--- /dev/null
+++ b/PowerControlPanel/Classes/Playnite/Playnite.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+
+namespace Power_Control_Panel.PowerControlPanel.Classes.Playnite
+{
+ public static class Playnite
+ {
+ public static void playniteToggle()
+ {
+ if (playniteRunning())
+ {
+ RunCLI.RunCommand(" --shutdown", false, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Playnite") + "\\Playnite.FullscreenApp.exe",6000,false);
+
+ }
+ else
+ {
+
+ RunCLI.RunCommand(" --startfullscreen", false, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Playnite") + "\\Playnite.FullscreenApp.exe",6000,false);
+
+ }
+ }
+
+ private static bool playniteRunning()
+ {
+
+
+ Process[] pname = Process.GetProcessesByName("Playnite.FullscreenApp");
+ if (pname.Length != 0)
+ {
+ return true;
+
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+ }
+}
diff --git a/PowerControlPanel/Classes/RunCLI/RunCLI.cs b/PowerControlPanel/Classes/RunCLI/RunCLI.cs
index 6739c0c..23f646d 100644
--- a/PowerControlPanel/Classes/RunCLI/RunCLI.cs
+++ b/PowerControlPanel/Classes/RunCLI/RunCLI.cs
@@ -12,7 +12,7 @@ namespace Power_Control_Panel.PowerControlPanel.Classes
public static class RunCLI
{
- public static string RunCommand(string arguments, bool readOutput, string processName = "cmd.exe", int waitExit=6000)
+ public static string RunCommand(string arguments, bool readOutput, string processName = "cmd.exe", int waitExit=6000, bool runasadmin=true)
{
//Runs CLI, if readOutput is true then returns output
@@ -28,8 +28,7 @@ public static string RunCommand(string arguments, bool readOutput, string proces
//startInfo.Arguments = "/c " + arguments;
startInfo.Arguments = arguments;
startInfo.CreateNoWindow = true;
-
- startInfo.Verb = "runas";
+ if (runasadmin) { startInfo.Verb = "runas"; }
startInfo.RedirectStandardError = readOutput;
startInfo.RedirectStandardOutput = readOutput;
process.EnableRaisingEvents = true;
diff --git a/PowerControlPanel/Classes/StartUp/StartUp.cs b/PowerControlPanel/Classes/StartUp/StartUp.cs
index 5354530..b6ff7ba 100644
--- a/PowerControlPanel/Classes/StartUp/StartUp.cs
+++ b/PowerControlPanel/Classes/StartUp/StartUp.cs
@@ -24,6 +24,11 @@ public static void runStartUp()
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.upgradeSettingsRequired = false;
Properties.Settings.Default.Save();
+
+ if (Properties.Settings.Default.systemAutoStart == "Enable")
+ {
+ PowerControlPanel.Classes.TaskSchedulerWin32.TaskSchedulerWin32.changeTaskService("Enable");
+ }
}
//if first run of app, then make the profile
diff --git a/PowerControlPanel/Classes/TaskSchedulerWin32/TaskSchedulerWin32.cs b/PowerControlPanel/Classes/TaskSchedulerWin32/TaskSchedulerWin32.cs
new file mode 100644
index 0000000..2c41bd2
--- /dev/null
+++ b/PowerControlPanel/Classes/TaskSchedulerWin32/TaskSchedulerWin32.cs
@@ -0,0 +1,48 @@
+using Microsoft.Win32.TaskScheduler;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Power_Control_Panel.PowerControlPanel.Classes.TaskSchedulerWin32
+{
+ public static class TaskSchedulerWin32
+ {
+ public static void changeTaskService(string systemAutoStart)
+ {
+ Microsoft.Win32.TaskScheduler.TaskService ts = new Microsoft.Win32.TaskScheduler.TaskService();
+ Microsoft.Win32.TaskScheduler.Task task = ts.GetTask("Power_Control_Panel");
+ string BaseDir = AppDomain.CurrentDomain.BaseDirectory;
+ if (task == null)
+ {
+ if (systemAutoStart == "Enable")
+ {
+ TaskDefinition td = ts.NewTask();
+
+ td.RegistrationInfo.Description = "Power Control Panel";
+ td.Triggers.AddNew(TaskTriggerType.Logon);
+ td.Principal.RunLevel = TaskRunLevel.Highest;
+ td.Settings.DisallowStartIfOnBatteries = false;
+ td.Settings.StopIfGoingOnBatteries = false;
+ td.Settings.RunOnlyIfIdle = false;
+
+ td.Actions.Add(new ExecAction(BaseDir + "\\Power Control Panel.exe"));
+
+ Microsoft.Win32.TaskScheduler.TaskService.Instance.RootFolder.RegisterTaskDefinition("Power_Control_Panel", td);
+
+ }
+ }
+
+ else
+ {
+ if (systemAutoStart == "Disable")
+ {
+ task.RegisterChanges();
+ ts.RootFolder.DeleteTask("Power_Control_Panel");
+ }
+ }
+
+ }
+ }
+}
diff --git a/PowerControlPanel/Pages/HomePage.xaml b/PowerControlPanel/Pages/HomePage.xaml
index f035f94..8a2fd18 100644
--- a/PowerControlPanel/Pages/HomePage.xaml
+++ b/PowerControlPanel/Pages/HomePage.xaml
@@ -268,13 +268,7 @@
-
-
-
-
-
-
-
+
diff --git a/PowerControlPanel/Pages/HomePage.xaml.cs b/PowerControlPanel/Pages/HomePage.xaml.cs
index b83518e..df90e57 100644
--- a/PowerControlPanel/Pages/HomePage.xaml.cs
+++ b/PowerControlPanel/Pages/HomePage.xaml.cs
@@ -120,7 +120,7 @@ private void displayItemSourceBind()
cboRefreshRate.ItemsSource = GlobalVariables.refreshRates;
cboResolution.ItemsSource = GlobalVariables.resolutions;
cboFPSLimit.ItemsSource = GlobalVariables.FPSLimits;
-
+ cboScaling.ItemsSource = GlobalVariables.scalings;
changingResolution = true;
cboResolution.SelectedIndex = 0;
changingResolution = false;
@@ -874,7 +874,7 @@ private void cboScaling_SelectionChanged(object sender, SelectionChangedEventArg
if (!changingScaling && cboScaling.SelectedValue.ToString() != "Default")
{
changingScaling = true;
- PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayScaling(cboScaling.SelectedValue.ToString());
+ PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayScaling(cboScaling.SelectedItem.ToString());
changingScaling = false;
}
@@ -891,7 +891,7 @@ private void cboProfile_SelectionChanged(object sender, SelectionChangedEventArg
{
if (cboProfile.SelectedValue.ToString() != "None")
{
- PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.applyProfile(cboProfile.SelectedValue.ToString());
+ PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.applyProfile(cboProfile.SelectedItem.ToString());
}
else
{
@@ -921,7 +921,7 @@ private void enableControlProfile_Toggled(object sender, RoutedEventArgs e)
private void cboFPSLimit_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(cboFPSLimit.SelectedValue.ToString());
+ PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(cboFPSLimit.SelectedItem.ToString());
}
}
}
diff --git a/PowerControlPanel/Pages/SettingsPage.xaml.cs b/PowerControlPanel/Pages/SettingsPage.xaml.cs
index 2e64c54..dcf060f 100644
--- a/PowerControlPanel/Pages/SettingsPage.xaml.cs
+++ b/PowerControlPanel/Pages/SettingsPage.xaml.cs
@@ -62,7 +62,7 @@ private void btnSave_Click(object sender, RoutedEventArgs e)
if (Properties.Settings.Default.systemAutoStart != cboAutoStart.Text)
{
Properties.Settings.Default.systemAutoStart = cboAutoStart.Text;
- changeTaskService(cboAutoStart.Text);
+ PowerControlPanel.Classes.TaskSchedulerWin32.TaskSchedulerWin32.changeTaskService(cboAutoStart.Text);
}
@@ -151,41 +151,7 @@ private void loadSettings()
txtbxShortCutOSK.Text = Properties.Settings.Default.oskButtonCombo;
txtbxShortCutQAM.Text = Properties.Settings.Default.qamButtonCombo;
}
- private void changeTaskService(string systemAutoStart)
- {
- Microsoft.Win32.TaskScheduler.TaskService ts = new Microsoft.Win32.TaskScheduler.TaskService();
- Microsoft.Win32.TaskScheduler.Task task = ts.GetTask("Power_Control_Panel");
- string BaseDir = AppDomain.CurrentDomain.BaseDirectory;
- if (task == null)
- {
- if (systemAutoStart == "Enable")
- {
- TaskDefinition td = ts.NewTask();
-
- td.RegistrationInfo.Description = "Power Control Panel";
- td.Triggers.AddNew(TaskTriggerType.Logon);
- td.Principal.RunLevel = TaskRunLevel.Highest;
- td.Settings.DisallowStartIfOnBatteries = false;
- td.Settings.StopIfGoingOnBatteries = false;
- td.Settings.RunOnlyIfIdle = false;
-
- td.Actions.Add(new ExecAction(BaseDir + "\\Power Control Panel.exe"));
-
- Microsoft.Win32.TaskScheduler.TaskService.Instance.RootFolder.RegisterTaskDefinition("Power_Control_Panel", td);
-
- }
- }
-
- else
- {
- if (systemAutoStart == "Disable")
- {
- task.RegisterChanges();
- ts.RootFolder.DeleteTask("Power_Control_Panel");
- }
- }
-
- }
+
private DependencyObject GetElementFromParent(DependencyObject parent, string childname)
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml b/PowerControlPanel/Pages/SliderHomePage.xaml
index 403c021..b64a24b 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml
@@ -225,13 +225,7 @@
-
-
-
-
-
-
-
+
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml.cs b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
index 5520502..24acf23 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml.cs
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
@@ -110,7 +110,7 @@ private void displayItemSourceBind()
cboRefreshRate.ItemsSource = GlobalVariables.refreshRates;
cboResolution.ItemsSource = GlobalVariables.resolutions;
cboFPSLimit.ItemsSource = GlobalVariables.FPSLimits;
-
+ cboScaling.ItemsSource = GlobalVariables.scalings;
changingResolution = true;
cboResolution.SelectedIndex = 0;
changingResolution = false;
@@ -628,10 +628,10 @@ private void cboRefreshRate_SelectionChanged(object sender, SelectionChangedEven
private void cboScaling_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (!changingScaling && cboScaling.SelectedValue.ToString() != "Default")
+ if (!changingScaling && cboScaling.SelectedItem.ToString() != "Default")
{
changingScaling = true;
- PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayScaling(cboScaling.SelectedValue.ToString());
+ PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayScaling(cboScaling.SelectedItem.ToString());
changingScaling = false;
}
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
index 623a1d1..dd36644 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -358,5 +358,17 @@ public bool upgradeSettingsRequired {
this["upgradeSettingsRequired"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("LB+DPadUp")]
+ public string playniteButtonCombo {
+ get {
+ return ((string)(this["playniteButtonCombo"]));
+ }
+ set {
+ this["playniteButtonCombo"] = value;
+ }
+ }
}
}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
index 62ee63f..ba26380 100644
--- a/Properties/Settings.settings
+++ b/Properties/Settings.settings
@@ -86,5 +86,8 @@
True
+
+ LB+DPadUp
+
\ No newline at end of file
From 8d7636b4586aab4ba3165f4fdf6edc6bc318f84c Mon Sep 17 00:00:00 2001
From: project-sbc <78889381+project-sbc@users.noreply.github.com>
Date: Mon, 10 Oct 2022 07:39:13 -0400
Subject: [PATCH 06/11] qam update
---
MainWindow.xaml.cs | 16 +-
Power Control Panel.csproj | 1 +
PowerControlPanel/Classes/VMQAM/SVM.cs | 41 +-
PowerControlPanel/Pages/HomePage.xaml.cs | 10 +-
PowerControlPanel/Pages/QAMHomePage.xaml | 362 ++++++++++++++++++
PowerControlPanel/Pages/QAMHomePage.xaml.cs | 354 +++++++++++++++++
.../Pages/SliderHomePage.xaml.cs | 2 +-
Properties/Settings.Designer.cs | 36 +-
Properties/Settings.settings | 10 +-
QuickAccessMenu.xaml | 19 +-
QuickAccessMenu.xaml.cs | 35 +-
11 files changed, 794 insertions(+), 92 deletions(-)
create mode 100644 PowerControlPanel/Pages/QAMHomePage.xaml
create mode 100644 PowerControlPanel/Pages/QAMHomePage.xaml.cs
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 5a1f602..7b92ca3 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -568,7 +568,6 @@ private void OSKEvent()
private void QAMEvent()
{
-
handleOpenCloseQAM();
}
@@ -581,18 +580,9 @@ void initializeNavigationFrame()
HamburgerMenuControl.Content = this.navigationServiceEx.Frame;
// Navigate to the home page.
- if (Properties.Settings.Default.homePageTypeMW == "Grouped Slider")
- {
- this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/HomePage.xaml", UriKind.RelativeOrAbsolute));
- }
- if (Properties.Settings.Default.homePageTypeMW == "Slider")
- {
- this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/SliderHomePage.xaml", UriKind.RelativeOrAbsolute));
- }
- if (Properties.Settings.Default.homePageTypeMW == "Tile")
- {
- this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/TileHomePage.xaml", UriKind.RelativeOrAbsolute));
- }
+
+ this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/QAMHomePage.xaml", UriKind.RelativeOrAbsolute));
+
}
private void HamburgerMenuControl_OnItemInvoked(object sender, HamburgerMenuItemInvokedEventArgs e)
diff --git a/Power Control Panel.csproj b/Power Control Panel.csproj
index 6e339db..c4d8cf5 100644
--- a/Power Control Panel.csproj
+++ b/Power Control Panel.csproj
@@ -124,6 +124,7 @@
+
diff --git a/PowerControlPanel/Classes/VMQAM/SVM.cs b/PowerControlPanel/Classes/VMQAM/SVM.cs
index e3d8211..146e3cb 100644
--- a/PowerControlPanel/Classes/VMQAM/SVM.cs
+++ b/PowerControlPanel/Classes/VMQAM/SVM.cs
@@ -26,8 +26,7 @@ public SVM()
Label = Application.Current.Resources["QAM_Menu_Hide"].ToString(),
});
- if (Properties.Settings.Default.homePageTypeQAM == "Grouped Slider")
- {
+
this.Menu.Add(new MI()
{
Icon = new PackIconFontAwesome() { Kind = PackIconFontAwesomeKind.HddSolid },
@@ -35,46 +34,12 @@ public SVM()
Label = Application.Current.Resources["QAM_Menu_System"].ToString(),
NavigationType = typeof(MainPage),
- NavigationDestination = new Uri("PowerControlPanel/Pages/HomePage.xaml", UriKind.RelativeOrAbsolute),
+ NavigationDestination = new Uri("PowerControlPanel/Pages/QAMHomePage.xaml", UriKind.RelativeOrAbsolute),
});
- }
- if (Properties.Settings.Default.homePageTypeQAM == "Slider")
- {
- this.Menu.Add(new MI()
- {
- Icon = new PackIconFontAwesome() { Kind = PackIconFontAwesomeKind.HddSolid },
+
- Label = Application.Current.Resources["QAM_Menu_System"].ToString(),
- NavigationType = typeof(MainPage),
-
- NavigationDestination = new Uri("PowerControlPanel/Pages/SliderHomePage.xaml", UriKind.RelativeOrAbsolute),
-
-
- });
- }
- if (Properties.Settings.Default.homePageTypeQAM == "Tile")
- {
- this.Menu.Add(new MI()
- {
- Icon = new PackIconFontAwesome() { Kind = PackIconFontAwesomeKind.HddSolid },
-
- Label = Application.Current.Resources["QAM_Menu_System"].ToString(),
- NavigationType = typeof(MainPage),
-
- NavigationDestination = new Uri("PowerControlPanel/Pages/TileHomePage.xaml", UriKind.RelativeOrAbsolute),
-
-
- });
- }
- this.Menu.Add(new MI()
- {
- Icon = new PackIconFontAwesome() { Kind = PackIconFontAwesomeKind.GamepadSolid },
- Label = Application.Current.Resources["QAM_Menu_Games"].ToString(),
- NavigationType = typeof(ProfilesPage),
- NavigationDestination = new Uri("PowerControlPanel/Pages/TileViewer.xaml", UriKind.RelativeOrAbsolute)
- });
this.OptionsMenu.Add(new MI()
{
Icon = new PackIconFontAwesome() { Kind = PackIconFontAwesomeKind.CogSolid },
diff --git a/PowerControlPanel/Pages/HomePage.xaml.cs b/PowerControlPanel/Pages/HomePage.xaml.cs
index df90e57..adafd83 100644
--- a/PowerControlPanel/Pages/HomePage.xaml.cs
+++ b/PowerControlPanel/Pages/HomePage.xaml.cs
@@ -53,7 +53,7 @@ public partial class HomePage : Page
//enabled booleans
private bool enableTDP = Properties.Settings.Default.enableTDP;
private bool enableGPUCLK = Properties.Settings.Default.enableGPUCLK;
- private bool enableSystem = Properties.Settings.Default.enableSystem;
+ private bool enableSystem = Properties.Settings.Default.enableVolume;
private bool enableDisplay = Properties.Settings.Default.enableDisplay;
private bool enableCPU = Properties.Settings.Default.enableCPU;
@@ -368,14 +368,14 @@ private void handleVisibility()
}
- if (!Properties.Settings.Default.enableSystem)
+ if (!Properties.Settings.Default.enableVolume)
{
GBSystemControls.Visibility = Visibility.Collapsed;
GBSystemControls.Margin = new Thickness(0, 0, 0, 0);
}
else
{
- if (Properties.Settings.Default.showSystem)
+ if (Properties.Settings.Default.showVolume)
{ enableControlSystem.IsOn = true; }
else { enableControlSystem.IsOn = false; GBSystemControls.Height = 40; enableControlSystem.IsOn = false; }
}
@@ -464,9 +464,9 @@ private void enableControlSystem_Toggled(object sender, RoutedEventArgs e)
if (enableControlSystem.IsOn)
{
GBSystemControls.Height = 150;
- Properties.Settings.Default.showSystem = true;
+ Properties.Settings.Default.showVolume = true;
}
- else { GBSystemControls.Height = 40; Properties.Settings.Default.showSystem = false; }
+ else { GBSystemControls.Height = 40; Properties.Settings.Default.showVolume = false; }
Properties.Settings.Default.Save();
}
}
diff --git a/PowerControlPanel/Pages/QAMHomePage.xaml b/PowerControlPanel/Pages/QAMHomePage.xaml
new file mode 100644
index 0000000..8725b29
--- /dev/null
+++ b/PowerControlPanel/Pages/QAMHomePage.xaml
@@ -0,0 +1,362 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerControlPanel/Pages/QAMHomePage.xaml.cs b/PowerControlPanel/Pages/QAMHomePage.xaml.cs
new file mode 100644
index 0000000..e6dc79e
--- /dev/null
+++ b/PowerControlPanel/Pages/QAMHomePage.xaml.cs
@@ -0,0 +1,354 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+using ControlzEx.Theming;
+using MahApps.Metro.Controls;
+
+namespace Power_Control_Panel.PowerControlPanel.Pages
+{
+ ///
+ /// Interaction logic for QAMHomePage.xaml
+ ///
+ public partial class QAMHomePage : Page
+ {
+ private string currentControl;
+ private bool controlActive = false;
+ private DispatcherTimer timer = new DispatcherTimer();
+ private bool dragStarted = false;
+
+
+ private Brush accentBrush = null;
+
+ public QAMHomePage()
+ {
+ InitializeComponent();
+
+
+ //apply theme
+ ThemeManager.Current.ChangeTheme(this, Properties.Settings.Default.systemTheme);
+
+ //force touch due to wpf bug
+ _ = Tablet.TabletDevices;
+
+ //set combobox sources
+ setComboBoxItemSource();
+
+ //set upper and lower limits on sliders
+ setMinMaxSliderValues();
+
+ //set visibility
+ setInitialVisibility();
+
+ //
+ }
+
+ private void setMinMaxSliderValues()
+ {
+ TDP1_Slider.Maximum = Properties.Settings.Default.maxTDP;
+ TDP2_Slider.Maximum = Properties.Settings.Default.maxTDP;
+ TDP_Slider.Maximum = Properties.Settings.Default.maxTDP;
+ TDP1_Slider.Minimum = Properties.Settings.Default.minTDP;
+ TDP2_Slider.Minimum = Properties.Settings.Default.minTDP;
+ TDP_Slider.Minimum = Properties.Settings.Default.minTDP;
+ ActiveCores_Slider.Maximum = GlobalVariables.maxCpuCores;
+ MAXCPU_Slider.Minimum = GlobalVariables.baseCPUSpeed;
+ AMDGPUCLK_Slider.Maximum = Properties.Settings.Default.maxGPUCLK;
+ }
+ private void setComboBoxItemSource()
+ {
+ FPSLimit_Cbo.ItemsSource = GlobalVariables.FPSLimits;
+ Scaling_Cbo.ItemsSource = GlobalVariables.scalings;
+ Resolution_Cbo.ItemsSource= GlobalVariables.resolutions;
+ RefreshRate_Cbo.ItemsSource =GlobalVariables.refreshRates;
+ Profile_Cbo.ItemsSource = PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.profileListForHomePage();
+ }
+
+ private void setInitialVisibility()
+ {
+ //get accentbrush
+ accentBrush = Profile_Tile.Background;
+ //hide tile and sliders if setting is disabled
+ if (!Properties.Settings.Default.enableDisplay)
+ {
+ RefreshRate_Border.Visibility = Visibility.Collapsed;
+ Resolution_Border.Visibility = Visibility.Collapsed;
+ Scaling_Border.Visibility = Visibility.Collapsed;
+ Display_Tile.Visibility = Visibility.Collapsed;
+ }
+
+ if (!Properties.Settings.Default.enableCPU)
+ {
+ MaxCPU_Border.Visibility = Visibility.Collapsed;
+ ActiveCores_Border.Visibility = Visibility.Collapsed;
+ CPU_Tile.Visibility = Visibility.Collapsed;
+ }
+
+ if (!Properties.Settings.Default.enableVolume)
+ {
+ Volume_Border.Visibility = Visibility.Collapsed;
+ Volume_Tile.Visibility = Visibility.Collapsed;
+ }
+
+ if (!Properties.Settings.Default.enableBrightness)
+ {
+ Brightness_Tile.Visibility = Visibility.Collapsed;
+ Brightness_Border.Visibility = Visibility.Collapsed;
+ }
+
+ if (!Properties.Settings.Default.enableTDP)
+ {
+ TDP1_Border.Visibility = Visibility.Collapsed;
+ TDP2_Border.Visibility = Visibility.Collapsed;
+ TDP_Border.Visibility = Visibility.Collapsed;
+ TDP_Tile.Visibility = Visibility.Collapsed;
+ }
+
+ if (!Properties.Settings.Default.enableGPUCLK)
+ {
+ AMDGPUCLK_Border.Visibility = Visibility.Collapsed;
+ AMD_Tile.Visibility = Visibility.Collapsed;
+ }
+
+ //hide just sliders if you don't want it showing
+ if (!Properties.Settings.Default.showDisplay)
+ {
+ RefreshRate_Border.Visibility = Visibility.Collapsed;
+ Resolution_Border.Visibility = Visibility.Collapsed;
+ Scaling_Border.Visibility = Visibility.Collapsed;
+ Display_Tile.Background = Brushes.Gray;
+ }
+
+ if (!Properties.Settings.Default.showCPU)
+ {
+ MaxCPU_Border.Visibility = Visibility.Collapsed;
+ ActiveCores_Border.Visibility = Visibility.Collapsed;
+ CPU_Tile.Background = Brushes.Gray;
+ }
+
+ if (!Properties.Settings.Default.showVolume)
+ {
+ Volume_Border.Visibility = Visibility.Collapsed;
+ Volume_Tile.Background = Brushes.Gray;
+ }
+
+ if (!Properties.Settings.Default.showBrightness)
+ {
+ Brightness_Border.Visibility = Visibility.Collapsed;
+ Brightness_Tile.Background = Brushes.Gray;
+ }
+
+ if (!Properties.Settings.Default.showTDP)
+ {
+ TDP1_Border.Visibility = Visibility.Collapsed;
+ TDP2_Border.Visibility = Visibility.Collapsed;
+ TDP_Border.Visibility = Visibility.Collapsed;
+ TDP_Tile.Background = Brushes.Gray;
+ }
+ if (Properties.Settings.Default.enableCombineTDP=="Enable")
+ {
+ TDP1_Border.Visibility = Visibility.Collapsed;
+ TDP2_Border.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ TDP_Border.Visibility = Visibility.Collapsed;
+ }
+
+ if (!Properties.Settings.Default.showGPUCLK)
+ {
+ AMDGPUCLK_Border.Visibility = Visibility.Collapsed;
+ AMD_Tile.Background = Brushes.Gray;
+ }
+
+ if (!PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.rtssRunning())
+ {
+ FPSLimit_Border.Visibility = Visibility.Collapsed;
+ FPSLimit_Tile.Visibility = Visibility.Collapsed;
+ }
+
+
+ //hide stuff that is cpu specific
+ if (GlobalVariables.cpuType == "Intel")
+ {
+ AMD_Tile.Visibility = Visibility.Collapsed;
+ AMD_Tile.Visibility = Visibility.Collapsed;
+ }
+ if (GlobalVariables.cpuType == "AMD")
+ {
+ Intel_Tile.Visibility = Visibility.Collapsed;
+ //place holder for future controls
+ }
+
+
+
+ }
+
+ private void Page_Loaded(object sender, RoutedEventArgs e)
+ {
+ //set height of scrollviewer
+ sliderScrollViewer.Height = this.ActualHeight - wrapPanel.ActualHeight;
+
+ }
+
+ private void Tile_Click(object sender, RoutedEventArgs e)
+ {
+ //handles all tile click events
+ Tile tile = (Tile)sender;
+ string tileName = tile.Name;
+ Brush backgroundBrush = accentBrush;
+ switch (tileName)
+ {
+ case "TDP_Tile":
+ if (Properties.Settings.Default.enableCombineTDP == "Enable")
+ {
+ if (TDP_Border.Visibility == Visibility.Collapsed)
+ {
+ TDP_Slider.Value = GlobalVariables.readPL1;
+ TDP_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showTDP = true;
+ TDP_Tile.Background = backgroundBrush;
+ }
+ else
+ {
+ TDP_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showTDP = false;
+ TDP_Tile.Background = Brushes.Gray;
+ }
+ }
+ else
+ {
+ if (TDP1_Border.Visibility == Visibility.Collapsed)
+ {
+ TDP1_Slider.Value = GlobalVariables.readPL1;
+ TDP2_Slider.Value = GlobalVariables.readPL2;
+ TDP1_Border.Visibility = Visibility.Visible;
+ TDP2_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showTDP = true;
+ TDP_Tile.Background = backgroundBrush;
+ }
+ else
+ {
+ TDP1_Border.Visibility = Visibility.Collapsed;
+ TDP2_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showTDP = false;
+ TDP_Tile.Background = Brushes.Gray;
+ }
+ }
+ break;
+ case "Volume_Tile":
+ if (Volume_Border.Visibility == Visibility.Collapsed)
+ {
+ VolumeSlider.Value = GlobalVariables.volume;
+ Volume_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showVolume = true;
+ Volume_Tile.Background = backgroundBrush;
+ }
+ else
+ {
+ Volume_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showVolume = false;
+ Volume_Tile.Background = Brushes.Gray;
+ }
+ break;
+ case "Brightness_Tile":
+ if (Brightness_Border.Visibility == Visibility.Collapsed)
+ {
+ BrightnessSlider.Value = GlobalVariables.volume;
+ Brightness_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showBrightness = true;
+ Brightness_Tile.Background = backgroundBrush;
+ }
+ else
+ {
+ Brightness_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showBrightness = false;
+ Brightness_Tile.Background = Brushes.Gray;
+ }
+ break;
+ case "Display_Tile":
+ if (Resolution_Border.Visibility == Visibility.Collapsed)
+ {
+ Resolution_Cbo.Text = GlobalVariables.resolution;
+ RefreshRate_Cbo.Text = GlobalVariables.refreshRate;
+ Scaling_Cbo.Text = GlobalVariables.scaling;
+ Resolution_Border.Visibility = Visibility.Visible;
+ RefreshRate_Border.Visibility = Visibility.Visible;
+ Scaling_Border.Visibility= Visibility.Visible;
+
+ Properties.Settings.Default.showDisplay = true;
+ Display_Tile.Background = backgroundBrush;
+ }
+ else
+ {
+ Resolution_Border.Visibility = Visibility.Collapsed;
+ RefreshRate_Border.Visibility = Visibility.Collapsed;
+ Scaling_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showDisplay = false;
+ Display_Tile.Background= Brushes.Gray;
+ }
+ break;
+ default:
+ break;
+
+
+ }
+ Properties.Settings.Default.Save();
+ }
+
+
+
+ private void Slider_Loaded(object sender, RoutedEventArgs e)
+ {
+ //set thumb size, internet routine
+ var SliderThumb = GetElementFromParent(sender as DependencyObject, "HorizontalThumb"); //Make sure to put the right name for your slider layout options are: ("VerticalThumb", "HorizontalThumb")
+ if (SliderThumb != null)
+ {
+
+ if (SliderThumb is Thumb thumb)
+ {
+
+ thumb.Width = 25;
+ thumb.Height = 35;
+ }
+ else { }
+ }
+ else { }
+ }
+
+
+ private DependencyObject GetElementFromParent(DependencyObject parent, string childname)
+ {
+ //Internet routine for finding thumb of slider
+ //Use element parent for thumb size control on slider
+ int count = VisualTreeHelper.GetChildrenCount(parent);
+ for (int i = 0; i < count; i++)
+ {
+ var child = VisualTreeHelper.GetChild(parent, i);
+ if (child is FrameworkElement childframeworkelement && childframeworkelement.Name == childname)
+ return child;
+
+ var FindRes = GetElementFromParent(child, childname);
+ if (FindRes != null)
+ return FindRes;
+ }
+ return null;
+ }
+
+ }
+
+}
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml.cs b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
index 24acf23..67e06d3 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml.cs
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
@@ -51,7 +51,7 @@ public partial class SliderHomePage : Page
//enabled booleans
private bool enableTDP = Properties.Settings.Default.enableTDP;
private bool enableGPUCLK = Properties.Settings.Default.enableGPUCLK;
- private bool enableSystem = Properties.Settings.Default.enableSystem;
+ private bool enableSystem = Properties.Settings.Default.enableVolume;
private bool enableDisplay = Properties.Settings.Default.enableDisplay;
private bool enableCPU = Properties.Settings.Default.enableCPU;
//profiles
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
index dd36644..1c94aa7 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -86,12 +86,12 @@ public string IntelMMIOMSR {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool enableSystem {
+ public bool enableVolume {
get {
- return ((bool)(this["enableSystem"]));
+ return ((bool)(this["enableVolume"]));
}
set {
- this["enableSystem"] = value;
+ this["enableVolume"] = value;
}
}
@@ -110,12 +110,12 @@ public bool showTDP {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool showSystem {
+ public bool showVolume {
get {
- return ((bool)(this["showSystem"]));
+ return ((bool)(this["showVolume"]));
}
set {
- this["showSystem"] = value;
+ this["showVolume"] = value;
}
}
@@ -370,5 +370,29 @@ public string playniteButtonCombo {
this["playniteButtonCombo"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool showBrightness {
+ get {
+ return ((bool)(this["showBrightness"]));
+ }
+ set {
+ this["showBrightness"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool enableBrightness {
+ get {
+ return ((bool)(this["enableBrightness"]));
+ }
+ set {
+ this["enableBrightness"] = value;
+ }
+ }
}
}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
index ba26380..ce07ff8 100644
--- a/Properties/Settings.settings
+++ b/Properties/Settings.settings
@@ -17,13 +17,13 @@
MMIO
-
+
True
True
-
+
True
@@ -89,5 +89,11 @@
LB+DPadUp
+
+ True
+
+
+ True
+
\ No newline at end of file
diff --git a/QuickAccessMenu.xaml b/QuickAccessMenu.xaml
index 500174b..be2ade1 100644
--- a/QuickAccessMenu.xaml
+++ b/QuickAccessMenu.xaml
@@ -5,11 +5,11 @@
xmlns:viewModels="clr-namespace:Power_Control_Panel.PowerControlPanel.Classes.VMQAM"
xmlns:navigation="clr-namespace:Power_Control_Panel.PowerControlPanel.Classes.Navigation"
xmlns:classes="clr-namespace:Power_Control_Panel.PowerControlPanel.Classes"
- xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
- UseNoneWindowStyle="True"
+ xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:iconPacks="clr-namespace:MahApps.Metro.IconPacks;assembly=MahApps.Metro.IconPacks.FontAwesome"
+ UseNoneWindowStyle="True"
ResizeMode="CanResizeWithGrip"
Topmost="True"
- Title="Power Control Panel" Height="600" Width="530" Closing="MetroWindow_Closing" MinWidth="450" MinHeight="350" Loaded="MetroWindow_Loaded">
+ Title="Power Control Panel" Height="600" Width="500" Closing="MetroWindow_Closing" MinWidth="450" MinHeight="350" Loaded="MetroWindow_Loaded">
@@ -101,7 +101,7 @@
-
+
@@ -110,8 +110,12 @@
-
-
+
+
+
+
@@ -119,8 +123,7 @@
-
-
+
this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/QAMHomePage.xaml", UriKind.RelativeOrAbsolute));
// Navigate to the home page.
- if (Properties.Settings.Default.homePageTypeQAM == "Slider")
- {
- this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/sliderHomePage.xaml", UriKind.RelativeOrAbsolute));
- }
- if (Properties.Settings.Default.homePageTypeQAM == "Grouped Slider")
- {
- this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/HomePage.xaml", UriKind.RelativeOrAbsolute));
- }
- if (Properties.Settings.Default.homePageTypeQAM == "Tile")
- {
- this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/TileHomePage.xaml", UriKind.RelativeOrAbsolute));
- }
+ //if (Properties.Settings.Default.homePageTypeQAM == "Slider")
+ //{
+ //this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/sliderHomePage.xaml", UriKind.RelativeOrAbsolute));
+ //}
+ //if (Properties.Settings.Default.homePageTypeQAM == "Grouped Slider")
+ //{
+ // this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/HomePage.xaml", UriKind.RelativeOrAbsolute));
+ //}
+ //if (Properties.Settings.Default.homePageTypeQAM == "Tile")
+ //{
+ // this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/TileHomePage.xaml", UriKind.RelativeOrAbsolute));
+ //}
}
private void HamburgerMenuControl_OnItemInvoked(object sender, HamburgerMenuItemInvokedEventArgs e)
@@ -270,7 +267,7 @@ void updateValues()
txtblkDateTime.Text = DateTime.Now.ToString("MM/dd/yyyy h:mm tt");
- txtblkCPUTempLoad.Text = "CPU T:" + GlobalVariables.cpuTemp + " C";
+
//game pad stuff here
//if (GlobalVariables.controller is null) { txtblkGamepad.Text = ""; } else { if (GlobalVariables.controller.IsConnected) { txtblkGamepad.Text = "\uE7FC"; } else { txtblkGamepad.Text = ""; } }
}
From f9d5c7ef96f60461b0ae1dd1ace8c09a17a7237a Mon Sep 17 00:00:00 2001
From: project-sbc <78889381+project-sbc@users.noreply.github.com>
Date: Wed, 12 Oct 2022 07:22:15 -0400
Subject: [PATCH 07/11] updates
---
PowerControlPanel/Pages/QAMHomePage.xaml | 646 +++++++++------
PowerControlPanel/Pages/QAMHomePage.xaml.cs | 797 +++++++++++++++----
PowerControlPanel/Pages/SettingsPage.xaml.cs | 4 +-
PowerControlPanel/Pages/TileHomePage.xaml | 2 +-
PowerControlPanel/Pages/TileHomePage.xaml.cs | 21 +-
Properties/Settings.Designer.cs | 36 +-
Properties/Settings.settings | 9 +-
QuickAccessMenu.xaml | 2 +-
8 files changed, 1058 insertions(+), 459 deletions(-)
diff --git a/PowerControlPanel/Pages/QAMHomePage.xaml b/PowerControlPanel/Pages/QAMHomePage.xaml
index 8725b29..2396e70 100644
--- a/PowerControlPanel/Pages/QAMHomePage.xaml
+++ b/PowerControlPanel/Pages/QAMHomePage.xaml
@@ -19,7 +19,7 @@
-
+
@@ -45,24 +45,34 @@
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
diff --git a/PowerControlPanel/Pages/HomePage.xaml.cs b/PowerControlPanel/Pages/HomePage.xaml.cs
index adafd83..8521ebd 100644
--- a/PowerControlPanel/Pages/HomePage.xaml.cs
+++ b/PowerControlPanel/Pages/HomePage.xaml.cs
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using System.Windows;
-using System.Threading;
using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
@@ -13,167 +15,77 @@
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-using MahApps.Metro.Controls;
-using Power_Control_Panel.PowerControlPanel.Classes.ChangeTDP;
using System.Windows.Threading;
-using System.Windows.Controls.Primitives;
using ControlzEx.Theming;
+using MahApps.Metro.Controls;
namespace Power_Control_Panel.PowerControlPanel.Pages
{
///
- /// Interaction logic for HomePage.xaml
+ /// Interaction logic for QAMHomePage.xaml
///
public partial class HomePage : Page
{
+ private string currentControl;
+ private bool controlActive = false;
private DispatcherTimer timer = new DispatcherTimer();
-
- //tdp variables
- private bool dragStartedTDP1 = false;
- private bool dragStartedTDP2 = false;
- private bool dragStartedTDP = false;
- private bool changingTDP = false;
-
- //system variables
- private bool dragStartedBrightness = false;
- private bool dragStartedVolume = false;
-
- //display settings
- private bool changingResolution = false;
+ private bool dragTDP = false;
+ private bool dragTDP1 = false;
+ private bool dragTDP2 = false;
+ private bool dragMaxCPU = false;
+ private bool dragActiveCores = false;
+ private bool dragGPUCLK = false;
+ private bool dragVolume = false;
+ private bool dragBrightness = false;
private bool changingRefreshRate = false;
+ private bool changingResolution = false;
+ private bool changingTDP = false;
private bool changingScaling = false;
-
- //profiles
+ private bool changingDisplay = false;
private bool changingProfiles = false;
-
- //AMD gpu clk
- private bool dragStartedGPUCLK = false;
- private bool changingGPUCLK = false;
-
- //enabled booleans
- private bool enableTDP = Properties.Settings.Default.enableTDP;
- private bool enableGPUCLK = Properties.Settings.Default.enableGPUCLK;
- private bool enableSystem = Properties.Settings.Default.enableVolume;
- private bool enableDisplay = Properties.Settings.Default.enableDisplay;
- private bool enableCPU = Properties.Settings.Default.enableCPU;
-
-
- private bool dragStartedMAXCPU = false;
- private bool changingMAXCPU = false;
-
- private bool dragStartedActiveCores = false;
- private bool changingActiveCores = false;
-
-
+ private Brush accentBrush = null;
public HomePage()
{
-
-
-
InitializeComponent();
- //set max cpu core count here
- //hide items
- if (GlobalVariables.cpuType != "AMD")
- {
- GBAMDGPUCLK.Visibility = Visibility.Collapsed;
- }
-
- initializeTimer();
-
- setMinMaxSliderValues();
//apply theme
ThemeManager.Current.ChangeTheme(this, Properties.Settings.Default.systemTheme);
- //Add list of resolution refresh to combo box
- displayItemSourceBind();
-
- //set profile list
- changingProfiles = true;
- cboProfile.ItemsSource = PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.profileListForHomePage();
- changingProfiles = false;
-
- loadUpdateValues();
-
//force touch due to wpf bug
_ = Tablet.TabletDevices;
- }
+ //get accent color
+ accentBrush = Profile_Tile.Background;
+ //set combobox sources
+ setComboBoxItemSource();
- private void setMinMaxSliderValues()
- {
- TDP1.Maximum = Properties.Settings.Default.maxTDP;
- TDP2.Maximum = Properties.Settings.Default.maxTDP;
- TDP1.Minimum = Properties.Settings.Default.minTDP;
- TDP2.Minimum = Properties.Settings.Default.minTDP;
- ActiveCores.Maximum = GlobalVariables.maxCpuCores;
- MAXCPU.Minimum = GlobalVariables.baseCPUSpeed;
- GPUCLK.Maximum = Properties.Settings.Default.maxGPUCLK;
- }
+ //set upper and lower limits on sliders
+ setMinMaxSliderValues();
- private void displayItemSourceBind()
- {
+ //set values
+ loadUpdateValues();
- cboRefreshRate.ItemsSource = GlobalVariables.refreshRates;
- cboResolution.ItemsSource = GlobalVariables.resolutions;
- cboFPSLimit.ItemsSource = GlobalVariables.FPSLimits;
- cboScaling.ItemsSource = GlobalVariables.scalings;
- changingResolution = true;
- cboResolution.SelectedIndex = 0;
- changingResolution = false;
- }
+ //set intial visibility (to remove disabled stuff)
+ hideDisabledItems();
-
+ setViewStyle();
- #region slider loaded change thumb
- private void Slider_Loaded(object sender, RoutedEventArgs e)
- {
- var SliderThumb = GetElementFromParent(sender as DependencyObject, "HorizontalThumb"); //Make sure to put the right name for your slider layout options are: ("VerticalThumb", "HorizontalThumb")
- if (SliderThumb != null)
- {
-
- if (SliderThumb is Thumb thumb)
- {
-
- thumb.Width = 20;
- thumb.Height = 25;
- }
- else { }
- }
- else { }
- }
- private DependencyObject GetElementFromParent(DependencyObject parent, string childname)
- {
+ setInitialVisibility();
- //Use element parent for thumb size control on slider
- int count = VisualTreeHelper.GetChildrenCount(parent);
- for (int i = 0; i < count; i++)
- {
- var child = VisualTreeHelper.GetChild(parent, i);
- if (child is FrameworkElement childframeworkelement && childframeworkelement.Name == childname)
- return child;
+ initializeTimer();
+ loadUpdateValues();
+ //
- var FindRes = GetElementFromParent(child, childname);
- if (FindRes != null)
- return FindRes;
- }
- return null;
}
-
-
-
- #endregion
-
- #region timer controls
private void initializeTimer()
{
- timer.Interval = new TimeSpan(0, 0, 5);
+ timer.Interval = new TimeSpan(0, 0, 3);
timer.Tick += timerTick;
timer.Start();
@@ -182,121 +94,124 @@ private void timerTick(object sender, EventArgs e)
{
loadUpdateValues();
- }
+ }
private void loadUpdateValues()
{
//GPU clock updates
- if (!dragStartedGPUCLK && enableGPUCLK)
+ if (!dragGPUCLK && Properties.Settings.Default.enableGPUCLK)
{
if (GlobalVariables.gpuclk == "Default")
{
- if (GPUCLK.Value != 200) { GPUCLK.Value = 200; }
-
+ if (AMDGPUCLK_Slider.Value != 200) { AMDGPUCLK_Slider.Value = 200; }
+ AMDGPUCLK_Label.Content = "Default";
+ GPUCLK_TileLabel.Content = "GPU Clock: Default";
}
else
{
- if (GPUCLK.Value != Int32.Parse(GlobalVariables.gpuclk))
+ if (AMDGPUCLK_Slider.Value != Int32.Parse(GlobalVariables.gpuclk))
{
- GPUCLK.Value = Int32.Parse(GlobalVariables.gpuclk);
+ AMDGPUCLK_Slider.Value = Int32.Parse(GlobalVariables.gpuclk);
+ GPUCLK_TileLabel.Content = "GPU Clock: " + GlobalVariables.gpuclk + " MHz";
}
}
}
//max cpu clock updates
- if (!dragStartedMAXCPU && enableCPU && GlobalVariables.needCPUMaxFreqRead == false)
+ if (!dragMaxCPU && Properties.Settings.Default.enableCPU && !GlobalVariables.needCPUMaxFreqRead)
{
if (GlobalVariables.cpuMaxFrequency == 0)
{
- changingMAXCPU = true;
- MAXCPU.Value = MAXCPU.Maximum;
- txtsliderMAXCPU.Visibility = Visibility.Collapsed;
- txtsliderMAXCPUAuto.Visibility = Visibility.Visible;
- changingMAXCPU = false;
+ MAXCPU_Slider.Value = MAXCPU_Slider.Maximum;
+ MaxCPU_Label.Content = "Auto";
+ MaxCPU_TileLabel.Content = "Max CPU: Auto";
}
else
{
- MAXCPU.Value = GlobalVariables.cpuMaxFrequency;
-
- txtsliderMAXCPUAuto.Visibility = Visibility.Collapsed;
- txtsliderMAXCPU.Visibility = Visibility.Visible;
+ MAXCPU_Slider.Value = GlobalVariables.cpuMaxFrequency;
+ MaxCPU_Label.Content = GlobalVariables.cpuMaxFrequency.ToString();
+ MaxCPU_TileLabel.Content = "Max CPU: " + GlobalVariables.cpuMaxFrequency.ToString() + " MHz";
}
}
//active core updates
- if (!dragStartedActiveCores && enableCPU && GlobalVariables.needActiveCoreRead == false)
+ if (!dragActiveCores && Properties.Settings.Default.enableCPU && !GlobalVariables.needActiveCoreRead)
{
- changingActiveCores = true;
- ActiveCores.Value = GlobalVariables.cpuActiveCores;
- changingActiveCores = false;
+ ActiveCores_Slider.Value = GlobalVariables.cpuActiveCores;
+ ActiveCores_TileLabel.Content = "Active Cores: " + GlobalVariables.cpuActiveCores;
}
+ //profile
+ if (Profile_Cbo.Text != GlobalVariables.ActiveProfile)
+ {
+ changingProfiles = true;
+ Profile_Cbo.Text = GlobalVariables.ActiveProfile;
+ changingProfiles = false;
+ }
+ Profile_TileLabel.Content = GlobalVariables.ActiveProfile;
+ App_TileLabel.Content = GlobalVariables.ActiveApp;
//display updates
- if (enableDisplay)
+ if (Properties.Settings.Default.enableDisplay)
{
- if (cboRefreshRate.Text != GlobalVariables.refreshRate && !changingRefreshRate)
+ ResolutionRefresh_TileLabel.Content = GlobalVariables.resolution + " " + GlobalVariables.refreshRate + " Hz";
+ Scaling_TileLabel.Content = GlobalVariables.scaling;
+ if (RefreshRate_Cbo.Text != GlobalVariables.refreshRate && !changingRefreshRate)
{
changingRefreshRate = true;
- cboRefreshRate.Text = GlobalVariables.refreshRate;
+ RefreshRate_Cbo.Text = GlobalVariables.refreshRate;
changingRefreshRate = false;
}
- if (cboResolution.Text != GlobalVariables.resolution && !changingResolution && GlobalVariables.resolution != "")
+ if (Resolution_Cbo.Text != GlobalVariables.resolution && !changingResolution && GlobalVariables.resolution != "")
{
changingResolution = true;
- cboResolution.Text = GlobalVariables.resolution;
+ Resolution_Cbo.Text = GlobalVariables.resolution;
changingResolution = false;
}
- if (cboScaling.Text != GlobalVariables.scaling && !changingScaling)
+ if (Scaling_Cbo.Text != GlobalVariables.scaling && !changingScaling)
{
changingScaling = true;
- cboScaling.Text = GlobalVariables.scaling;
+ Scaling_Cbo.Text = GlobalVariables.scaling;
changingScaling = false;
}
-
-
-
}
if (PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.rtssRunning())
{
- cboFPSLimit.Text = GlobalVariables.FPSLimit;
-
- rdFPSLimit.Height = new GridLength(50);
- dpFPSLimit.Visibility = Visibility.Visible;
+ FPSLimit_Cbo.Text = GlobalVariables.FPSLimit;
+ FPSLimit_TileLabel.Content = GlobalVariables.FPSLimit;
+ FPSLimit_Tile.Visibility = Visibility.Visible;
+ FPSLimit_Border.Visibility = Visibility.Visible;
}
else
{
- rdFPSLimit.Height = new GridLength(0);
- dpFPSLimit.Visibility = Visibility.Collapsed;
+ FPSLimit_Tile.Visibility = Visibility.Collapsed;
+ FPSLimit_Border.Visibility = Visibility.Collapsed;
}
- //profile
- if (!changingProfiles)
- {
- changingProfiles = true;
- cboProfile.Text = GlobalVariables.ActiveProfile;
- changingProfiles = false;
-
- }
//system values
- if (enableSystem)
+ if (Properties.Settings.Default.enableVolume && !GlobalVariables.needVolumeRead && !dragVolume)
{
- if (!dragStartedBrightness && !GlobalVariables.needBrightnessRead) { Brightness.Value = GlobalVariables.brightness; }
- if (!dragStartedVolume && !GlobalVariables.needVolumeRead)
- { Volume.Value = GlobalVariables.volume; }
+ Volume_Slider.Value = GlobalVariables.volume;
+ Volume_TileLabel.Content = GlobalVariables.volume + "%";
+ }
+ if (Properties.Settings.Default.enableBrightness && !GlobalVariables.needBrightnessRead && !dragBrightness)
+ {
+ Brightness_Slider.Value = GlobalVariables.brightness;
+ Brightness_TileLabel.Content = GlobalVariables.brightness + "%";
}
-
//TPD
- if (enableTDP)
+ if (Properties.Settings.Default.enableTDP)
{
if (GlobalVariables.readPL1 > 0 && GlobalVariables.readPL2 > 0)
{
+ TDP1_TileLabel.Content = "Sustained TDP: " + GlobalVariables.readPL1 + " W";
+ TDP2_TileLabel.Content = "Boost TDP: " + GlobalVariables.readPL2 + " W";
changingTDP = true;
updateFromGlobalTDPPL1();
updateFromGlobalTDPPL2();
@@ -307,525 +222,732 @@ private void loadUpdateValues()
}
}
+ void updateFromGlobalTDP()
+ {
+ //Make changingTDP boolean true to prevent slider event from updating TDP
+ if (GlobalVariables.needTDPRead == false)
+ {
-
+ try
+ {
+ if (!dragTDP & Math.Abs(TDP_Slider.Value - GlobalVariables.readPL1) > 0.9)
+ { TDP_Slider.Value = Math.Round(GlobalVariables.readPL1, 0, MidpointRounding.AwayFromZero); }
+ }
+ catch { }
- #endregion timer controls
+ }
- #region handle visibility
+ }
- private void handleVisibility()
+ void updateFromGlobalTDPPL1()
{
- //handle enabling and showing gpu clock
- if (!Properties.Settings.Default.enableGPUCLK ^ GlobalVariables.cpuType == "Intel")
+ //Make changingTDP boolean true to prevent slider event from updating TDP
+ if (GlobalVariables.needTDPRead == false)
{
- GBAMDGPUCLK.Visibility = Visibility.Collapsed;
- GBAMDGPUCLK.Margin = new Thickness(0, 0, 0, 0);
+
+ try
+ {
+ if (!dragTDP1 & Math.Abs(TDP1_Slider.Value - GlobalVariables.readPL1) > 0.9)
+ { TDP1_Slider.Value = Math.Round(GlobalVariables.readPL1, 0, MidpointRounding.AwayFromZero); }
+ }
+ catch { }
}
- else
+
+ }
+ void updateFromGlobalTDPPL2()
+ {
+ //Make changingTDP boolean true to prevent slider event from updating TDP
+ if (GlobalVariables.needTDPRead == false)
{
- if (Properties.Settings.Default.showGPUCLK)
- { enableControlGPUCLK.IsOn = true; }
- else
- { enableControlGPUCLK.IsOn = false; GBAMDGPUCLK.Height = 40; enableControlGPUCLK.IsOn = false; }
+
+
+ try
+ {
+ if (!dragTDP2 & Math.Abs(TDP2_Slider.Value - GlobalVariables.readPL2) > 0.9)
+ { TDP2_Slider.Value = Math.Round(GlobalVariables.readPL2, 0, MidpointRounding.AwayFromZero); }
+ }
+ catch { }
+
+
+
}
+ }
- if (!Properties.Settings.Default.enableTDP)
+
+ private void hideDisabledItems()
+ {
+ //set enable/disable
+ if (!Properties.Settings.Default.enableDisplay)
{
- GBTDPControls.Visibility = Visibility.Collapsed;
- GBTDPControls.Margin = new Thickness(0, 0, 0, 0);
+ Display_GroupBorder.Visibility = Visibility.Collapsed;
+ Display_Tile.Visibility = Visibility.Collapsed;
}
- else
+
+ if (!Properties.Settings.Default.enableCPU)
{
- if (Properties.Settings.Default.showTDP)
- { enableControlTDP.IsOn = true; }
- else { enableControlTDP.IsOn = false; GBTDPControls.Height = 40; enableControlTDP.IsOn = false; }
+ CPU_GroupBorder.Visibility = Visibility.Collapsed;
+ CPU_Tile.Visibility = Visibility.Collapsed;
+ }
- //handle if they want combined tdp or pl1 and pl2 separate
- if (Properties.Settings.Default.enableCombineTDP == "Enable")
- {
- dpTDP1.Visibility = Visibility.Collapsed;
- dpTDP2.Visibility = Visibility.Collapsed;
- rdTDP1.Height = new GridLength(0);
- rdTDP2.Height = new GridLength(0);
- }
- else { dpTDP.Visibility = Visibility.Collapsed; rdTDP.Height = new GridLength(0); }
+ if (!Properties.Settings.Default.enableVolume)
+ {
+ Volume_GroupBorder.Visibility = Visibility.Collapsed;
+ Volume_Tile.Visibility = Visibility.Collapsed;
+ }
+ if (!Properties.Settings.Default.enableBrightness)
+ {
+ Brightness_GroupBorder.Visibility = Visibility.Collapsed;
+ Brightness_Tile.Visibility = Visibility.Collapsed;
}
- if (!Properties.Settings.Default.enableCPU)
+ if (!Properties.Settings.Default.enableTDP)
{
- GBCPUControls.Visibility = Visibility.Collapsed;
- GBCPUControls.Margin = new Thickness(0, 0, 0, 0);
+ TDP_GroupBorder.Visibility = Visibility.Collapsed;
+ TDP_Tile.Visibility = Visibility.Collapsed;
}
- else
+
+ if (!Properties.Settings.Default.enableGPUCLK)
{
- if (Properties.Settings.Default.showTDP)
- { enableControlCPU.IsOn = true; }
- else { enableControlCPU.IsOn = false; GBCPUControls.Height = 40; enableControlCPU.IsOn = false; }
+ AMD_GroupBorder.Visibility = Visibility.Collapsed;
+ AMD_Tile.Visibility = Visibility.Collapsed;
}
+ if (!PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.rtssRunning())
+ {
+ FPSLimit_Border.Visibility = Visibility.Collapsed;
+ FPSLimit_Tile.Visibility = Visibility.Collapsed;
+ }
- if (!Properties.Settings.Default.enableVolume)
+ if (Properties.Settings.Default.enableCombineTDP == "Enable")
{
- GBSystemControls.Visibility = Visibility.Collapsed;
- GBSystemControls.Margin = new Thickness(0, 0, 0, 0);
+ TDP1_Border.Visibility = Visibility.Collapsed;
+ TDP2_Border.Visibility = Visibility.Collapsed;
+
}
else
{
- if (Properties.Settings.Default.showVolume)
- { enableControlSystem.IsOn = true; }
- else { enableControlSystem.IsOn = false; GBSystemControls.Height = 40; enableControlSystem.IsOn = false; }
+ TDP_Border.Visibility = Visibility.Collapsed;
+
}
- if (!Properties.Settings.Default.enableDisplay)
+
+ //hide stuff that is cpu specific
+ if (GlobalVariables.cpuType == "Intel")
{
- GBDisplayControls.Visibility = Visibility.Collapsed;
- GBDisplayControls.Margin = new Thickness(0, 0, 0, 0);
+ AMD_Tile.Visibility = Visibility.Collapsed;
+ AMD_Tile.Visibility = Visibility.Collapsed;
}
- else
+
+ //havent added intel specific stuff, will fix in the future
+ Intel_Tile.Visibility = Visibility.Collapsed;
+
+ //hide game launcher tiles that aren't configured
+ if (Properties.Settings.Default.directoryPlaynite == "")
+ {
+ PlayNite_Tile.Visibility = Visibility.Collapsed;
+ }
+ if (Properties.Settings.Default.directorySteam == "")
{
- if (Properties.Settings.Default.showDisplay)
- { enableControlDisplay.IsOn = true; }
- else { enableControlDisplay.IsOn = false; GBDisplayControls.Height = 40; enableControlDisplay.IsOn = false; }
+ Steam_Tile.Visibility = Visibility.Collapsed;
}
+ }
+ private void setMinMaxSliderValues()
+ {
+ TDP1_Slider.Maximum = Properties.Settings.Default.maxTDP;
+ TDP2_Slider.Maximum = Properties.Settings.Default.maxTDP;
+ TDP_Slider.Maximum = Properties.Settings.Default.maxTDP;
+ TDP1_Slider.Minimum = Properties.Settings.Default.minTDP;
+ TDP2_Slider.Minimum = Properties.Settings.Default.minTDP;
+ TDP_Slider.Minimum = Properties.Settings.Default.minTDP;
+ ActiveCores_Slider.Maximum = GlobalVariables.maxCpuCores;
+ MAXCPU_Slider.Minimum = GlobalVariables.baseCPUSpeed;
+ AMDGPUCLK_Slider.Maximum = Properties.Settings.Default.maxGPUCLK;
+ }
+ private void setComboBoxItemSource()
+ {
+ FPSLimit_Cbo.ItemsSource = GlobalVariables.FPSLimits;
+ Scaling_Cbo.ItemsSource = GlobalVariables.scalings;
+ Resolution_Cbo.ItemsSource = GlobalVariables.resolutions;
+ RefreshRate_Cbo.ItemsSource = GlobalVariables.refreshRates;
+ Profile_Cbo.ItemsSource = PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.profileListForHomePage();
+ changingResolution = true;
+ Resolution_Cbo.SelectedIndex = 0;
+ changingResolution = false;
}
+ private void setViewStyle()
+ {
+
- #endregion handle visibility
+ //set by view style
+ if (Properties.Settings.Default.homePageTypeQAM == "Tile")
+ {
+ removeGroupSliderBoxAndBorder();
+ }
+ if (Properties.Settings.Default.homePageTypeQAM == "Slider")
+ {
+ removeGroupSliderBoxAndBorder();
+ wrapPanel.Visibility = Visibility.Collapsed;
+ }
+ if (Properties.Settings.Default.homePageTypeQAM == "Group Slider")
+ {
+ wrapPanel.Visibility = Visibility.Collapsed;
+ }
+ }
- #region toggle group box
- private void enableControlGPUCLK_Toggled(object sender, RoutedEventArgs e)
+ private void resetView()
{
- if (this.IsLoaded)
+ AMD_BoxHeader.Visibility = Visibility.Visible;
+ Brightness_BoxHeader.Visibility = Visibility.Visible;
+ CPU_BoxHeader.Visibility = Visibility.Visible;
+ Display_BoxHeader.Visibility = Visibility.Visible;
+ FPSLimit_BoxHeader.Visibility = Visibility.Visible;
+ Profile_BoxHeader.Visibility = Visibility.Visible;
+ TDP_BoxHeader.Visibility = Visibility.Visible;
+ Volume_BoxHeader.Visibility = Visibility.Visible;
+
+ wrapPanel.Visibility = Visibility.Visible;
+
+ TDP_GroupBorder.BorderThickness = new Thickness(3);
+ CPU_GroupBorder.BorderThickness = new Thickness(3);
+ Display_GroupBorder.BorderThickness = new Thickness(3);
+ Volume_GroupBorder.BorderThickness = new Thickness(3);
+ Brightness_GroupBorder.BorderThickness = new Thickness(3);
+ Profile_GroupBorder.BorderThickness = new Thickness(3);
+ AMD_GroupBorder.BorderThickness = new Thickness(3);
+ FPSLimit_GroupBorder.BorderThickness = new Thickness(3);
+
+
+
+ }
+ private void removeGroupSliderBoxAndBorder()
+ {
+ //get rid of border and box headers
+ TDP_GroupBorder.BorderThickness = new Thickness(0);
+ CPU_GroupBorder.BorderThickness = new Thickness(0);
+ Display_GroupBorder.BorderThickness = new Thickness(0);
+ Volume_GroupBorder.BorderThickness = new Thickness(0);
+ Brightness_GroupBorder.BorderThickness = new Thickness(0);
+ Profile_GroupBorder.BorderThickness = new Thickness(0);
+ AMD_GroupBorder.BorderThickness = new Thickness(0);
+ FPSLimit_GroupBorder.BorderThickness = new Thickness(0);
+
+
+ AMD_BoxHeader.Visibility = Visibility.Collapsed;
+ Brightness_BoxHeader.Visibility = Visibility.Collapsed;
+ CPU_BoxHeader.Visibility = Visibility.Collapsed;
+ Display_BoxHeader.Visibility = Visibility.Collapsed;
+ FPSLimit_BoxHeader.Visibility = Visibility.Collapsed;
+ Profile_BoxHeader.Visibility = Visibility.Collapsed;
+ TDP_BoxHeader.Visibility = Visibility.Collapsed;
+ Volume_BoxHeader.Visibility = Visibility.Collapsed;
+ }
+
+ private void setInitialVisibility()
+ {
+
+ //hide tile and sliders if setting is disabled
+
+
+ //hide just sliders if you don't want it showing
+ if (!Properties.Settings.Default.showTDP && Properties.Settings.Default.enableTDP)
{
- if (enableControlGPUCLK.IsOn)
- {
- GBAMDGPUCLK.Height = 100;
- Properties.Settings.Default.showGPUCLK = true;
- }
- else
- {
- GBAMDGPUCLK.Height = 40;
- Properties.Settings.Default.showGPUCLK = false;
- }
- Properties.Settings.Default.Save();
+ handleToggleControls("TDP_Toggle", false);
}
+ if (!Properties.Settings.Default.showDisplay && Properties.Settings.Default.enableDisplay)
+ {
+ handleToggleControls("Display_Toggle", false);
+ }
+
+ if (!Properties.Settings.Default.showCPU && Properties.Settings.Default.enableCPU)
+ {
+ handleToggleControls("CPU_Toggle", false);
+ }
+
+ if (!Properties.Settings.Default.showVolume && Properties.Settings.Default.enableVolume)
+ {
+ handleToggleControls("Volume_Toggle", false);
+ }
+
+ if (!Properties.Settings.Default.showBrightness && Properties.Settings.Default.enableBrightness)
+ {
+ handleToggleControls("Brightness_Toggle", false);
+ }
+
+
+
+
+ if (!Properties.Settings.Default.showGPUCLK && Properties.Settings.Default.enableGPUCLK)
+ {
+ handleToggleControls("AMD_Toggle", false);
+ }
+
+
+
+
+
}
+ private void Page_Loaded(object sender, RoutedEventArgs e)
+ {
+ //set height of scrollviewer
+ //sliderScrollViewer.Height = this.ActualHeight - wrapPanel.ActualHeight;
+ setInitialVisibility();
- private void enableControlTDP_Toggled(object sender, RoutedEventArgs e)
+ }
+
+ private void Tile_Click(object sender, RoutedEventArgs e)
{
- if (this.IsLoaded)
+ //handles all tile click events
+ Tile tile = (Tile)sender;
+ string tileName = tile.Name;
+
+ switch (tileName)
{
- if (enableControlTDP.IsOn)
- {
- GBTDPControls.Height = double.NaN;
- Properties.Settings.Default.showTDP = true;
- }
- else
- {
- GBTDPControls.Height = 40;
- Properties.Settings.Default.showTDP = false;
- }
- Properties.Settings.Default.Save();
+ case "TDP_Tile":
+ TDP_Toggle.IsOn = !TDP_Toggle.IsOn;
+ break;
+ case "Volume_Tile":
+ Volume_Toggle.IsOn = !Volume_Toggle.IsOn;
+ break;
+ case "Brightness_Tile":
+ Brightness_Toggle.IsOn = !Brightness_Toggle.IsOn;
+ break;
+ case "Display_Tile":
+ Display_Toggle.IsOn = !Display_Toggle.IsOn;
+ break;
+ case "CPU_Tile":
+ CPU_Toggle.IsOn = !CPU_Toggle.IsOn;
+ break;
+ case "AMD_Tile":
+ AMD_Toggle.IsOn = !AMD_Toggle.IsOn;
+ break;
+ case "Profile_Tile":
+ Profile_Toggle.IsOn = !Profile_Toggle.IsOn;
+ break;
+ case "FPSLimit_Tile":
+ FPSLimit_Toggle.IsOn = !FPSLimit_Toggle.IsOn;
+ break;
+ case "Steam_Tile":
+ PowerControlPanel.Classes.Steam.Steam.openSteamBigPicture();
+ break;
+ case "PlayNite_Tile":
+ PowerControlPanel.Classes.Playnite.Playnite.playniteToggle();
+ break;
+ default:
+ break;
+
+
}
+
}
-
- private void enableControlCPU_Toggled(object sender, RoutedEventArgs e)
+ private void Slider_Loaded(object sender, RoutedEventArgs e)
{
- if (this.IsLoaded)
+ //set thumb size, internet routine
+ var SliderThumb = GetElementFromParent(sender as DependencyObject, "HorizontalThumb"); //Make sure to put the right name for your slider layout options are: ("VerticalThumb", "HorizontalThumb")
+ if (SliderThumb != null)
{
- if (enableControlCPU.IsOn)
- {
- GBCPUControls.Height = 150;
- Properties.Settings.Default.showCPU = true;
- }
- else
+
+ if (SliderThumb is Thumb thumb)
{
- GBCPUControls.Height = 40;
- Properties.Settings.Default.showCPU = false;
+
+ thumb.Width = 25;
+ thumb.Height = 35;
}
- Properties.Settings.Default.Save();
+ else { }
}
+ else { }
}
- private void enableControlSystem_Toggled(object sender, RoutedEventArgs e)
+
+
+ private DependencyObject GetElementFromParent(DependencyObject parent, string childname)
{
- if (this.IsLoaded)
+ //Internet routine for finding thumb of slider
+ //Use element parent for thumb size control on slider
+ int count = VisualTreeHelper.GetChildrenCount(parent);
+ for (int i = 0; i < count; i++)
{
- if (enableControlSystem.IsOn)
- {
- GBSystemControls.Height = 150;
- Properties.Settings.Default.showVolume = true;
- }
- else { GBSystemControls.Height = 40; Properties.Settings.Default.showVolume = false; }
- Properties.Settings.Default.Save();
+ var child = VisualTreeHelper.GetChild(parent, i);
+ if (child is FrameworkElement childframeworkelement && childframeworkelement.Name == childname)
+ return child;
+
+ var FindRes = GetElementFromParent(child, childname);
+ if (FindRes != null)
+ return FindRes;
}
+ return null;
}
- private void enableControlDisplay_Toggled(object sender, RoutedEventArgs e)
+
+
+ private void Toggle_Toggled(object sender, RoutedEventArgs e)
{
+
if (this.IsLoaded)
{
- if (enableControlDisplay.IsOn)
- {
- GBDisplayControls.Height = 200;
- Properties.Settings.Default.showDisplay = true;
- }
- else
- {
- GBDisplayControls.Height = 40;
- Properties.Settings.Default.showDisplay = false;
- }
- Properties.Settings.Default.Save();
- }
+ ToggleSwitch toggleSwitch = (ToggleSwitch)sender;
+ string toggleName = toggleSwitch.Name;
+ handleToggleControls(toggleName, toggleSwitch.IsOn);
+ }
- }
- #endregion
- #region slider value changed
- private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
- {
- Slider slider = sender as Slider;
- string sliderName = slider.Name;
- if (this.IsLoaded)
+ }
+ private void handleToggleControls(string toggleName, bool toggleSwitch)
+ {
+ if (toggleSwitch)
{
- switch (sliderName)
+ switch (toggleName)
{
- case "TDP1":
- if (!dragStartedTDP1 && !changingTDP)
+ case "TDP_Toggle":
+ if (Properties.Settings.Default.enableCombineTDP == "Enable")
{
- HandleChangingTDP((int)TDP1.Value, (int)TDP2.Value, true);
+ TDP_Border.Visibility = Visibility.Visible;
}
- break;
- case "TDP":
- if (!dragStartedTDP && !changingTDP)
+ else
{
- HandleChangingTDP((int)TDP.Value, (int)TDP.Value, true);
+ TDP1_Border.Visibility = Visibility.Visible;
+ TDP2_Border.Visibility = Visibility.Visible;
}
+ TDP_Tile.Background = accentBrush;
+ Properties.Settings.Default.showTDP = true;
break;
- case "TDP2":
- if (!dragStartedTDP2 && !changingTDP)
- {
- HandleChangingTDP((int)TDP1.Value, (int)TDP2.Value, true);
- }
+ case "AMD_Toggle":
+ AMDGPUCLK_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showGPUCLK = true;
+ AMD_Tile.Background = accentBrush;
break;
- case "Brightness":
- if (!dragStartedBrightness)
- {
- HandleChangingBrightness(Brightness.Value);
- }
+ case "CPU_Toggle":
+ MaxCPU_Border.Visibility = Visibility.Visible;
+ ActiveCores_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showCPU = true;
+ CPU_Tile.Background = accentBrush;
break;
-
- case "Volume":
- if (!dragStartedVolume)
- {
- HandleChangingVolume((int)Volume.Value);
- }
+ case "Display_Toggle":
+ Resolution_Border.Visibility = Visibility.Visible;
+ RefreshRate_Border.Visibility = Visibility.Visible;
+ Scaling_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showDisplay = true;
+ Display_Tile.Background = accentBrush;
break;
- case "GPUCLK":
- if (!dragStartedGPUCLK && !changingGPUCLK)
- {
- HandleChangingGPUCLK((int)GPUCLK.Value);
- }
+ case "Volume_Toggle":
+ Volume_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showVolume = true;
+ Volume_Tile.Background = accentBrush;
break;
- case "MAXCPU":
- if (!dragStartedMAXCPU && !changingMAXCPU)
- {
- HandleChangingMAXCPU((int)MAXCPU.Value);
- }
- if (MAXCPU.Value == MAXCPU.Maximum)
- {
- txtsliderMAXCPU.Visibility = Visibility.Collapsed;
- txtsliderMAXCPUAuto.Visibility = Visibility.Visible;
- }
- else
- {
- txtsliderMAXCPUAuto.Visibility = Visibility.Collapsed;
- txtsliderMAXCPU.Visibility = Visibility.Visible;
- }
+ case "Brightness_Toggle":
+ Brightness_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showBrightness = true;
+ Brightness_Tile.Background = accentBrush;
break;
- case "ActiveCores":
- if (!dragStartedActiveCores && !changingActiveCores)
- {
- HandleChangingActiveCores(Convert.ToDouble(ActiveCores.Value));
- }
+ case "FPSLimit_Toggle":
+ FPSLimit_Border.Visibility = Visibility.Visible;
+ FPSLimit_Tile.Background = accentBrush;
+ break;
+ case "Profile_Toggle":
+ Profile_Border.Visibility = Visibility.Visible;
+ Profile_Tile.Background = accentBrush;
break;
default:
break;
- }
- }
- }
-
- #endregion
- #region slider drag completed
- private void Slider_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
- {
- Slider slider = sender as Slider;
- string sliderName = slider.Name;
-
- if (this.IsLoaded)
+ }
+ }
+ else
{
- switch (sliderName)
+ switch (toggleName)
{
- case "TDP1":
- dragStartedTDP1 = false;
- HandleChangingTDP((int)TDP1.Value, (int)TDP2.Value, true);
+ case "TDP_Toggle":
+ if (Properties.Settings.Default.enableCombineTDP == "Enable")
+ {
+ TDP_Border.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ TDP1_Border.Visibility = Visibility.Collapsed;
+ TDP2_Border.Visibility = Visibility.Collapsed;
+ }
+ Properties.Settings.Default.showTDP = false;
+ TDP_Tile.Background = Brushes.Gray;
break;
- case "TDP2":
- dragStartedTDP2 = false;
- HandleChangingTDP((int)TDP1.Value, (int)TDP2.Value, true);
+ case "AMD_Toggle":
+ AMDGPUCLK_Border.Visibility = Visibility.Collapsed;
+ AMD_Tile.Background = Brushes.Gray;
+ Properties.Settings.Default.showGPUCLK = false;
break;
- case "TDP":
- dragStartedTDP = false;
- HandleChangingTDP((int)TDP.Value, (int)TDP.Value, true);
+ case "CPU_Toggle":
+ MaxCPU_Border.Visibility = Visibility.Collapsed;
+ ActiveCores_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showCPU = false;
+ CPU_Tile.Background = Brushes.Gray;
break;
- case "Brightness":
- dragStartedBrightness = false;
- HandleChangingBrightness(Brightness.Value);
+ case "Display_Toggle":
+ Resolution_Border.Visibility = Visibility.Collapsed;
+ RefreshRate_Border.Visibility = Visibility.Collapsed;
+ Scaling_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showDisplay = false;
+ Display_Tile.Background = Brushes.Gray;
break;
-
- case "Volume":
- dragStartedVolume = false;
- HandleChangingVolume((int)Volume.Value);
+ case "Volume_Toggle":
+ Volume_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showVolume = false;
+ Volume_Tile.Background = Brushes.Gray;
break;
- case "GPUCLK":
- dragStartedGPUCLK = false;
- HandleChangingGPUCLK((int)GPUCLK.Value);
+ case "Brightness_Toggle":
+ Brightness_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showBrightness = false;
+ Brightness_Tile.Background = Brushes.Gray;
break;
- case "MAXCPU":
- dragStartedMAXCPU = false;
- HandleChangingMAXCPU((int)MAXCPU.Value);
+ case "FPSLimit_Toggle":
+ FPSLimit_Border.Visibility = Visibility.Collapsed;
+ FPSLimit_Tile.Background = Brushes.Gray;
break;
- case "ActiveCores":
- dragStartedActiveCores = false;
- HandleChangingActiveCores(Convert.ToDouble(ActiveCores.Value));
+ case "Profile_Toggle":
+ Profile_Border.Visibility = Visibility.Collapsed;
+ Profile_Tile.Background = Brushes.Gray;
break;
default:
break;
+
+
+
}
}
+ Properties.Settings.Default.Save();
}
-
-
- #endregion
- #region slider drag started
- private void Slider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
- {
- Slider slider = sender as Slider;
-
- string sliderName = slider.Name;
- if (this.IsLoaded)
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ switch (Properties.Settings.Default.homePageTypeQAM)
{
- switch (sliderName)
- {
- case "TDP1":
- dragStartedTDP1 = true;
- break;
- case "TDP":
- dragStartedTDP = true;
- break;
- case "TDP2":
- dragStartedTDP2 = true;
- break;
- case "Brightness":
- dragStartedBrightness = true;
- break;
- case "Volume":
- dragStartedVolume = true;
- break;
- case "GPUCLK":
- dragStartedGPUCLK = true;
- break;
- case "MAXCPU":
- dragStartedMAXCPU = true;
- break;
- case "ActiveCores":
- dragStartedActiveCores = true;
- break;
- default:
- break;
- }
+ case "Slider":
+ Properties.Settings.Default.homePageTypeQAM = "Group Slider";
+ break;
+ case "Group Slider":
+ Properties.Settings.Default.homePageTypeQAM = "Tile";
+ break;
+ case "Tile":
+ Properties.Settings.Default.homePageTypeQAM = "Slider";
+ break;
+ default:
+ break;
}
+ Properties.Settings.Default.Save();
+ resetView();
+ setViewStyle();
}
-
- #endregion
- void updateFromGlobalTDP()
+
+ private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
- //Make changingTDP boolean true to prevent slider event from updating TDP
- if (GlobalVariables.needTDPRead == false)
+ if (this.IsLoaded)
{
-
- try
+ Slider slider = (Slider)sender;
+ string sliderName = slider.Name;
+ //if new value = old value, dont update it, no point
+ if (e.NewValue != e.OldValue)
{
- if (!dragStartedTDP & Math.Abs(TDP.Value - GlobalVariables.readPL1) > 0.9)
- { TDP.Value = Math.Round(GlobalVariables.readPL1, 0, MidpointRounding.AwayFromZero); }
+
+ handleChangeValues(sliderName, false, false, e.NewValue);
}
- catch { }
}
}
- void updateFromGlobalTDPPL1()
+ private void Slider_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
{
- //Make changingTDP boolean true to prevent slider event from updating TDP
- if (GlobalVariables.needTDPRead == false)
- {
+ Slider slider = (Slider)sender;
+ string sliderName = slider.Name;
+ double sliderValue = slider.Value;
+ handleChangeValues(sliderName, false, true, sliderValue);
- try
- {
- if (!dragStartedTDP1 & Math.Abs(TDP1.Value - GlobalVariables.readPL1) > 0.9)
- { TDP1.Value = Math.Round(GlobalVariables.readPL1, 0, MidpointRounding.AwayFromZero); }
- }
- catch { }
+ }
- }
+ private void Slider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
+ {
+ Slider slider = (Slider)sender;
+ string sliderName = slider.Name;
+ double sliderValue = slider.Value;
+ handleChangeValues(sliderName, true, false, sliderValue);
}
- void updateFromGlobalTDPPL2()
+ private void handleChangeValues(string sliderName, bool dragStarted, bool dragCompleted, double sliderValue)
{
- //Make changingTDP boolean true to prevent slider event from updating TDP
- if (GlobalVariables.needTDPRead == false)
+ if (this.IsLoaded)
{
-
-
- try
+ switch (sliderName)
{
- if (!dragStartedTDP2 & Math.Abs(TDP2.Value - GlobalVariables.readPL2) > 0.9)
- { TDP2.Value = Math.Round(GlobalVariables.readPL2, 0, MidpointRounding.AwayFromZero); }
- }
- catch { }
-
-
-
- }
+ case "TDP_Slider":
+ if (dragStarted) { dragTDP = true; }
+ else
+ {
+ if (dragCompleted) { dragTDP = false; }
+ if (!dragTDP)
+ {
+ HandleChangingTDP((int)sliderValue, (int)sliderValue, true);
+ }
+ }
- }
+ break;
+ case "TDP1_Slider":
+ if (dragStarted) { dragTDP1 = true; }
+ else
+ {
+ if (dragCompleted) { dragTDP1 = false; }
+ if (!dragTDP1)
+ {
+ HandleChangingTDP((int)sliderValue, (int)TDP2_Slider.Value, true);
+ }
+ }
+ break;
+ case "TDP2_Slider":
+ if (dragStarted) { dragTDP2 = true; }
+ else
+ {
+ if (dragCompleted) { dragTDP = false; }
+ if (!dragTDP2)
+ {
+ HandleChangingTDP((int)TDP1_Slider.Value, (int)sliderValue, false);
+ }
+ }
+ break;
+ case "AMDGPUCLK_Slider":
+ if (dragStarted) { dragGPUCLK = true; }
+ else
+ {
+ if (dragCompleted) { dragGPUCLK = false; }
+ if (!dragGPUCLK)
+ {
+ Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.ChangeGPUCLK.ChangeGPUCLK.changeAMDGPUClock((int)sliderValue));
+ AMDGPUCLK_Label.Content = sliderValue.ToString();
+ }
- #region system controls
+ }
+ break;
+ case "Volume_Slider":
+ if (dragStarted) { dragVolume = true; }
+ else
+ {
+ if (dragCompleted) { dragVolume = false; }
+ if (!dragVolume)
+ {
+ GlobalVariables.needVolumeRead = true;
+ Classes.TaskScheduler.TaskScheduler.runTask(() => Classes.ChangeVolume.AudioManager.SetMasterVolume((float)sliderValue));
+ }
+ }
+ break;
+ case "Brightness_Slider":
+ if (dragStarted) { dragBrightness = true; }
+ else
+ {
+ if (dragCompleted) { dragBrightness = false; }
+ if (!dragBrightness)
+ {
+ GlobalVariables.needBrightnessRead = true;
+ Classes.TaskScheduler.TaskScheduler.runTask(() => Classes.ChangeBrightness.WindowsSettingsBrightnessController.setBrightness((int)sliderValue));
+ }
+ }
+ break;
+ case "MAXCPU_Slider":
+ if (dragStarted) { dragMaxCPU = true; }
+ else
+ {
+ if (dragCompleted) { dragMaxCPU = false; }
+ if (!dragMaxCPU)
+ {
+ GlobalVariables.needCPUMaxFreqRead = true;
+ int sendMaxCPU = 0;
+ if ((int)sliderValue != MAXCPU_Slider.Maximum)
+ {
+ //update label because maxcpu is special
+ MaxCPU_Label.Content = sliderValue.ToString();
+ sendMaxCPU = (int)sliderValue;
+ }
+ else
+ {
+ MaxCPU_Label.Content = "Auto";
+ }
+ Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.changeCPU.ChangeCPU.changeCPUMaxFrequency(sendMaxCPU));
+ }
+ }
+ break;
- private void HandleChangingTDP(int tdpPL1, int tdpPL2, bool PL1started)
- {
- //6800U MessageBox.Show("can change tdp:" + !changingTDP);
- if (!changingTDP)
- {
- changingTDP = true;
- GlobalVariables.needTDPRead = true;
- Thread.Sleep(150);
- if (PL1started)
- {
- //If PL1 is greater than PL2 then PL2 needs to be set to the PL1 value
+ case "ActiveCores_Slider":
+ if (dragStarted) { dragActiveCores = true; }
+ else
+ {
+ if (dragCompleted) { dragActiveCores = false; }
+ if (!dragActiveCores)
+ {
+ GlobalVariables.needActiveCoreRead = true;
+ Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.changeCPU.ChangeCPU.changeActiveCores((int)sliderValue));
+ }
- if (tdpPL1 < tdpPL2) { Classes.TaskScheduler.TaskScheduler.runTask(() => GlobalVariables.tdp.changeTDP(tdpPL1, tdpPL2)); }
- else
- {
- TDP2.Value = tdpPL1;
- tdpPL2 = tdpPL1;
- Classes.TaskScheduler.TaskScheduler.runTask(() => GlobalVariables.tdp.changeTDP(tdpPL1, tdpPL2));
- };
- }
- else
- {
- //If PL2 is less than PL1 drop PL1 down to PL2 new value
- if (tdpPL1 < tdpPL2) { Classes.TaskScheduler.TaskScheduler.runTask(() => GlobalVariables.tdp.changeTDP(tdpPL1, tdpPL2)); }
- else
- {
- TDP1.Value = tdpPL2;
- tdpPL1 = tdpPL2;
- Classes.TaskScheduler.TaskScheduler.runTask(() => GlobalVariables.tdp.changeTDP(tdpPL1, tdpPL2));
- };
+ }
+ break;
+ default:
+ break;
}
-
- changingTDP = false;
}
}
-
- void HandleChangingBrightness(double brightness)
- {
- GlobalVariables.needBrightnessRead = true;
- Classes.ChangeBrightness.WindowsSettingsBrightnessController.setBrightness((int)brightness);
- }
- void HandleChangingVolume(int volume)
+ private void HandleChangingTDP(int tdpPL1, int tdpPL2, bool PL1started)
{
- GlobalVariables.needVolumeRead = true;
- Classes.ChangeVolume.AudioManager.SetMasterVolume((float)volume);
- }
-
-
- private void HandleChangingMAXCPU(int maxcpu)
- {
- if (this.IsLoaded)
+ GlobalVariables.needTDPRead = true;
+ Thread.Sleep(150);
+ if (PL1started)
{
- if(dragStartedMAXCPU == false)
- {
- changingMAXCPU = true;
- GlobalVariables.needCPUMaxFreqRead = true;
- int sendMaxCPU = 0;
- if (maxcpu != MAXCPU.Maximum) { sendMaxCPU = maxcpu; }
-
+ //If PL1 is greater than PL2 then PL2 needs to be set to the PL1 value
- Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.changeCPU.ChangeCPU.changeCPUMaxFrequency(sendMaxCPU));
-
- changingMAXCPU = false;
- }
-
+ if (tdpPL1 < tdpPL2) { Classes.TaskScheduler.TaskScheduler.runTask(() => GlobalVariables.tdp.changeTDP(tdpPL1, tdpPL2)); }
+ else
+ {
+ tdpPL2 = tdpPL1;
+ Classes.TaskScheduler.TaskScheduler.runTask(() => GlobalVariables.tdp.changeTDP(tdpPL1, tdpPL2));
+ };
}
-
-
-
- }
-
- private void HandleChangingActiveCores(double cores)
- {
- if (this.IsLoaded)
+ else
{
- if (dragStartedActiveCores == false && !changingActiveCores)
+ //If PL2 is less than PL1 drop PL1 down to PL2 new value
+ if (tdpPL1 < tdpPL2) { Classes.TaskScheduler.TaskScheduler.runTask(() => GlobalVariables.tdp.changeTDP(tdpPL1, tdpPL2)); }
+ else
{
- changingActiveCores = true;
- GlobalVariables.needActiveCoreRead = true;
- Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.changeCPU.ChangeCPU.changeActiveCores(cores));
-
- changingActiveCores = false;
- }
-
+ tdpPL1 = tdpPL2;
+ Classes.TaskScheduler.TaskScheduler.runTask(() => GlobalVariables.tdp.changeTDP(tdpPL1, tdpPL2));
+ };
}
-
}
@@ -833,65 +955,43 @@ private void HandleChangingGPUCLK(int gpuclk)
{
if (this.IsLoaded)
{
- changingGPUCLK = true;
+
Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.ChangeGPUCLK.ChangeGPUCLK.changeAMDGPUClock(gpuclk));
- txtsliderAMDGPUCLKDEF.Content = "";
- changingGPUCLK = false;
}
}
- #endregion system controls
-
-
- #region GPU Clock Slider
-
-
-
-
-
-
- #endregion GPU Clock Slider
-
-
-
- private void cboResolution_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private void Resolution_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (GlobalVariables.resolution != cboResolution.SelectedItem && !changingResolution && cboResolution.SelectedItem != "Custom Scaling")
- { PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayResolution(cboResolution.SelectedItem.ToString()); }
+ if (GlobalVariables.resolution != Resolution_Cbo.SelectedItem && !changingResolution && Resolution_Cbo.SelectedItem != "Custom Scaling")
+ { PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayResolution(Resolution_Cbo.SelectedItem.ToString()); }
}
- private void cboRefreshRate_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private void RefreshRate_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (GlobalVariables.refreshRate != cboRefreshRate.SelectedItem && !changingRefreshRate)
- { PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayRefreshRate(cboRefreshRate.SelectedItem.ToString()); }
+ if (GlobalVariables.refreshRate != RefreshRate_Cbo.SelectedItem && !changingRefreshRate)
+ { PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayRefreshRate(RefreshRate_Cbo.SelectedItem.ToString()); }
}
- private void cboScaling_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private void Scaling_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (!changingScaling && cboScaling.SelectedValue.ToString() != "Default")
+ if (!changingScaling && Scaling_Cbo.SelectedItem.ToString() != "Default")
{
changingScaling = true;
- PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayScaling(cboScaling.SelectedItem.ToString());
+ PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayScaling(Scaling_Cbo.SelectedItem.ToString());
changingScaling = false;
}
}
-
- private void Page_Loaded(object sender, RoutedEventArgs e)
- {
- handleVisibility();
- }
-
- private void cboProfile_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private void Profile_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!changingProfiles)
{
- if (cboProfile.SelectedValue.ToString() != "None")
+ if (Profile_Cbo.SelectedValue.ToString() != "None")
{
- PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.applyProfile(cboProfile.SelectedItem.ToString());
+ PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.applyProfile(Profile_Cbo.SelectedValue.ToString());
}
else
{
@@ -899,29 +999,12 @@ private void cboProfile_SelectionChanged(object sender, SelectionChangedEventArg
}
}
}
-
- private void enableControlProfile_Toggled(object sender, RoutedEventArgs e)
+ private void FPSLimit_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (this.IsLoaded)
- {
- if (enableControlProfile.IsOn)
- {
- GBProfiles.Height = 200;
- Properties.Settings.Default.showProfiles = true;
- }
- else
- {
- GBProfiles.Height = 40;
- Properties.Settings.Default.showProfiles = false;
- }
- Properties.Settings.Default.Save();
- }
-
+ PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(FPSLimit_Cbo.SelectedValue.ToString());
}
- private void cboFPSLimit_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(cboFPSLimit.SelectedItem.ToString());
- }
+
}
+
}
diff --git a/PowerControlPanel/Pages/QAMHomePage.xaml b/PowerControlPanel/Pages/QAMHomePage.xaml
index 5c0fa38..7c89d5c 100644
--- a/PowerControlPanel/Pages/QAMHomePage.xaml
+++ b/PowerControlPanel/Pages/QAMHomePage.xaml
@@ -92,7 +92,7 @@
-
+
@@ -136,7 +136,7 @@
-
+
@@ -146,26 +146,26 @@
-
+
-
-
+
+
-
+
-
+
@@ -182,35 +182,35 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
@@ -260,15 +260,15 @@
-
-
+
+
-
+
@@ -281,7 +281,7 @@
-
+
@@ -298,17 +298,17 @@
-
-
+
+
-
+
-
+
@@ -318,9 +318,9 @@
-
+
-
+
@@ -330,9 +330,9 @@
-
+
-
+
@@ -349,8 +349,8 @@
-
-
+
+
@@ -358,7 +358,7 @@
-
+
@@ -375,17 +375,17 @@
-
-
+
+
-
+
-
+
@@ -398,15 +398,15 @@
-
-
+
+
-
+
@@ -424,15 +424,15 @@
-
-
+
+
-
+
@@ -447,17 +447,17 @@
-
-
+
+
-
+
-
+
@@ -478,7 +478,7 @@
-
+
diff --git a/PowerControlPanel/Pages/QAMHomePage.xaml.cs b/PowerControlPanel/Pages/QAMHomePage.xaml.cs
index 060d4c2..b7b4d27 100644
--- a/PowerControlPanel/Pages/QAMHomePage.xaml.cs
+++ b/PowerControlPanel/Pages/QAMHomePage.xaml.cs
@@ -74,6 +74,7 @@ public QAMHomePage()
setViewStyle();
+ setInitialVisibility();
initializeTimer();
loadUpdateValues();
@@ -104,14 +105,14 @@ private void loadUpdateValues()
{
if (AMDGPUCLK_Slider.Value != 200) { AMDGPUCLK_Slider.Value = 200; }
AMDGPUCLK_Label.Content = "Default";
- GPUCLK_TileLabel.Content = "GPU Clock: Default";
+ GPUCLK_TileLabel.Content = Application.Current.Resources["TileHomePage_GPUCLK"].ToString() + ": Default";
}
else
{
if (AMDGPUCLK_Slider.Value != Int32.Parse(GlobalVariables.gpuclk))
{
AMDGPUCLK_Slider.Value = Int32.Parse(GlobalVariables.gpuclk);
- GPUCLK_TileLabel.Content = "GPU Clock: " + GlobalVariables.gpuclk + " MHz";
+ GPUCLK_TileLabel.Content = Application.Current.Resources["TileHomePage_GPUCLK"].ToString() + ": " + GlobalVariables.gpuclk + " MHz";
}
}
}
@@ -122,14 +123,14 @@ private void loadUpdateValues()
if (GlobalVariables.cpuMaxFrequency == 0)
{
MAXCPU_Slider.Value = MAXCPU_Slider.Maximum;
- MaxCPU_Label.Content = "Auto";
- MaxCPU_TileLabel.Content = "Max CPU: Auto";
+ MaxCPU_Label.Content = Application.Current.Resources["Auto"].ToString();
+ MaxCPU_TileLabel.Content = Application.Current.Resources["TileHomePage_MaxCPU"].ToString() + ": " + Application.Current.Resources["Auto"].ToString();
}
else
{
MAXCPU_Slider.Value = GlobalVariables.cpuMaxFrequency;
MaxCPU_Label.Content = GlobalVariables.cpuMaxFrequency.ToString();
- MaxCPU_TileLabel.Content = "Max CPU: " + GlobalVariables.cpuMaxFrequency.ToString() + " MHz";
+ MaxCPU_TileLabel.Content = Application.Current.Resources["TileHomePage_MaxCPU"].ToString()+ ": " + GlobalVariables.cpuMaxFrequency.ToString() + " MHz";
}
}
@@ -138,14 +139,15 @@ private void loadUpdateValues()
if (!dragActiveCores && Properties.Settings.Default.enableCPU && !GlobalVariables.needActiveCoreRead)
{
ActiveCores_Slider.Value = GlobalVariables.cpuActiveCores;
- ActiveCores_TileLabel.Content = "Active Cores: " + GlobalVariables.cpuActiveCores ;
+ ActiveCores_TileLabel.Content = Application.Current.Resources["TileHomePage_ActiveCores"].ToString() + ": " + GlobalVariables.cpuActiveCores ;
}
//profile
if (Profile_Cbo.Text != GlobalVariables.ActiveProfile)
{
+ changingProfiles = true;
Profile_Cbo.Text = GlobalVariables.ActiveProfile;
- Profile_TileLabel.Content = GlobalVariables.ActiveProfile;
+ changingProfiles = false;
}
Profile_TileLabel.Content = GlobalVariables.ActiveProfile;
App_TileLabel.Content = GlobalVariables.ActiveApp;
@@ -208,8 +210,8 @@ private void loadUpdateValues()
{
if (GlobalVariables.readPL1 > 0 && GlobalVariables.readPL2 > 0)
{
- TDP1_TileLabel.Content = "Sustained TDP: " +GlobalVariables.readPL1 + " W";
- TDP2_TileLabel.Content = "Boost TDP: " + GlobalVariables.readPL2 + " W";
+ TDP1_TileLabel.Content = Application.Current.Resources["TileHomePage_TDPSustained"].ToString() + ": " +GlobalVariables.readPL1 + " W";
+ TDP2_TileLabel.Content = Application.Current.Resources["TileHomePage_TDPBoost"].ToString() + ": " + GlobalVariables.readPL2 + " W";
changingTDP = true;
updateFromGlobalTDPPL1();
updateFromGlobalTDPPL2();
@@ -341,7 +343,17 @@ private void hideDisabledItems()
//havent added intel specific stuff, will fix in the future
Intel_Tile.Visibility = Visibility.Collapsed;
-
+
+ //hide game launcher tiles that aren't configured
+ if (Properties.Settings.Default.directoryPlaynite == "")
+ {
+ PlayNite_Tile.Visibility = Visibility.Collapsed;
+ }
+ if (Properties.Settings.Default.directorySteam == "")
+ {
+ Steam_Tile.Visibility = Visibility.Collapsed;
+ }
+
}
private void setMinMaxSliderValues()
@@ -363,26 +375,38 @@ private void setComboBoxItemSource()
Resolution_Cbo.ItemsSource = GlobalVariables.resolutions;
RefreshRate_Cbo.ItemsSource = GlobalVariables.refreshRates;
Profile_Cbo.ItemsSource = PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.profileListForHomePage();
+
+ changingResolution = true;
+ Resolution_Cbo.SelectedIndex = 0;
+ changingResolution = false;
}
private void setViewStyle()
{
-
-
- //set by view style
- if (Properties.Settings.Default.homePageTypeQAM == "Tile")
+ if (this.Title == "QAMHomePage")
{
- removeGroupSliderBoxAndBorder();
+ //set by view style
+ if (Properties.Settings.Default.homePageTypeQAM == "Tile")
+ {
+ removeGroupSliderBoxAndBorder();
+ }
+ if (Properties.Settings.Default.homePageTypeQAM == "Slider")
+ {
+ removeGroupSliderBoxAndBorder();
+ wrapPanel.Visibility = Visibility.Collapsed;
+ }
+ if (Properties.Settings.Default.homePageTypeQAM == "Group Slider")
+ {
+ wrapPanel.Visibility = Visibility.Collapsed;
+ }
}
- if (Properties.Settings.Default.homePageTypeQAM == "Slider")
+ else
{
removeGroupSliderBoxAndBorder();
- wrapPanel.Visibility = Visibility.Collapsed;
- }
- if (Properties.Settings.Default.homePageTypeQAM == "Group Slider")
- {
- wrapPanel.Visibility = Visibility.Collapsed;
+ rdViewChange.Height = new GridLength(0);
+ borderChangeViewStyle.Visibility = Visibility.Collapsed;
}
+
}
private void resetView()
@@ -442,34 +466,33 @@ private void setInitialVisibility()
//hide just sliders if you don't want it showing
if (!Properties.Settings.Default.showTDP && Properties.Settings.Default.enableTDP)
{
+ handleToggleControls("TDP_Toggle", false);
TDP_Toggle.IsOn = false;
-
}
if (!Properties.Settings.Default.showDisplay && Properties.Settings.Default.enableDisplay)
{
+ handleToggleControls("Display_Toggle", false);
Display_Toggle.IsOn = false;
-
}
if (!Properties.Settings.Default.showCPU && Properties.Settings.Default.enableCPU)
{
- CPU_Toggle.IsOn = false;
+ handleToggleControls("CPU_Toggle", false);
+ CPU_Toggle.IsOn = false;
}
if (!Properties.Settings.Default.showVolume && Properties.Settings.Default.enableVolume)
{
+ handleToggleControls("Volume_Toggle", false);
Volume_Toggle.IsOn = false;
-
-
}
if (!Properties.Settings.Default.showBrightness && Properties.Settings.Default.enableBrightness)
{
-
+ handleToggleControls("Brightness_Toggle", false);
Brightness_Toggle.IsOn = false;
-
}
@@ -477,6 +500,7 @@ private void setInitialVisibility()
if (!Properties.Settings.Default.showGPUCLK && Properties.Settings.Default.enableGPUCLK)
{
+ handleToggleControls("AMD_Toggle", false);
AMD_Toggle.IsOn = false;
}
@@ -526,7 +550,9 @@ private void Tile_Click(object sender, RoutedEventArgs e)
case "FPSLimit_Tile":
FPSLimit_Toggle.IsOn = !FPSLimit_Toggle.IsOn;
break;
-
+ case "Steam_Tile":
+ PowerControlPanel.Classes.Steam.Steam.openSteamBigPicture();
+ break;
case "PlayNite_Tile":
PowerControlPanel.Classes.Playnite.Playnite.playniteToggle();
break;
@@ -578,142 +604,147 @@ private DependencyObject GetElementFromParent(DependencyObject parent, string ch
private void Toggle_Toggled(object sender, RoutedEventArgs e)
{
+
if (this.IsLoaded)
{
ToggleSwitch toggleSwitch = (ToggleSwitch)sender;
string toggleName = toggleSwitch.Name;
- if (toggleSwitch.IsOn)
+
+ handleToggleControls(toggleName, toggleSwitch.IsOn);
+ }
+
+
+
+
+
+ }
+ private void handleToggleControls(string toggleName, bool toggleSwitch)
+ {
+ if (toggleSwitch)
+ {
+ switch (toggleName)
{
- switch (toggleName)
- {
- case "TDP_Toggle":
- if (Properties.Settings.Default.enableCombineTDP == "Enable")
- {
- TDP_Border.Visibility = Visibility.Visible;
- }
- else
- {
- TDP1_Border.Visibility = Visibility.Visible;
- TDP2_Border.Visibility = Visibility.Visible;
- }
- TDP_Tile.Background = accentBrush;
- Properties.Settings.Default.showTDP = true;
- break;
- case "AMD_Toggle":
- AMDGPUCLK_Border.Visibility = Visibility.Visible;
- Properties.Settings.Default.showGPUCLK = true;
- AMD_Tile.Background = accentBrush;
- break;
- case "CPU_Toggle":
- MaxCPU_Border.Visibility = Visibility.Visible;
- ActiveCores_Border.Visibility = Visibility.Visible;
- Properties.Settings.Default.showCPU = true;
- CPU_Tile.Background = accentBrush;
- break;
- case "Display_Toggle":
- Resolution_Border.Visibility = Visibility.Visible;
- RefreshRate_Border.Visibility = Visibility.Visible;
- Scaling_Border.Visibility = Visibility.Visible;
- Properties.Settings.Default.showDisplay = true;
- Display_Tile.Background = accentBrush;
- break;
- case "Volume_Toggle":
- Volume_Border.Visibility = Visibility.Visible;
- Properties.Settings.Default.showVolume = true;
- Volume_Tile.Background = accentBrush;
- break;
- case "Brightness_Toggle":
- Brightness_Border.Visibility = Visibility.Visible;
- Properties.Settings.Default.showBrightness = true;
- Brightness_Tile.Background = accentBrush;
- break;
- case "FPSLimit_Toggle":
- FPSLimit_Border.Visibility = Visibility.Visible;
- FPSLimit_Tile.Background = accentBrush;
- break;
- case "Profile_Toggle":
- Profile_Border.Visibility = Visibility.Visible;
- Profile_Tile.Background = accentBrush;
- break;
- default:
- break;
+ case "TDP_Toggle":
+ if (Properties.Settings.Default.enableCombineTDP == "Enable")
+ {
+ TDP_Border.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ TDP1_Border.Visibility = Visibility.Visible;
+ TDP2_Border.Visibility = Visibility.Visible;
+ }
+ TDP_Tile.Background = accentBrush;
+ Properties.Settings.Default.showTDP = true;
+ break;
+ case "AMD_Toggle":
+ AMDGPUCLK_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showGPUCLK = true;
+ AMD_Tile.Background = accentBrush;
+ break;
+ case "CPU_Toggle":
+ MaxCPU_Border.Visibility = Visibility.Visible;
+ ActiveCores_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showCPU = true;
+ CPU_Tile.Background = accentBrush;
+ break;
+ case "Display_Toggle":
+ Resolution_Border.Visibility = Visibility.Visible;
+ RefreshRate_Border.Visibility = Visibility.Visible;
+ Scaling_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showDisplay = true;
+ Display_Tile.Background = accentBrush;
+ break;
+ case "Volume_Toggle":
+ Volume_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showVolume = true;
+ Volume_Tile.Background = accentBrush;
+ break;
+ case "Brightness_Toggle":
+ Brightness_Border.Visibility = Visibility.Visible;
+ Properties.Settings.Default.showBrightness = true;
+ Brightness_Tile.Background = accentBrush;
+ break;
+ case "FPSLimit_Toggle":
+ FPSLimit_Border.Visibility = Visibility.Visible;
+ FPSLimit_Tile.Background = accentBrush;
+ break;
+ case "Profile_Toggle":
+ Profile_Border.Visibility = Visibility.Visible;
+ Profile_Tile.Background = accentBrush;
+ break;
+ default:
+ break;
- }
}
- else
+ }
+ else
+ {
+ switch (toggleName)
{
- switch (toggleName)
- {
- case "TDP_Toggle":
- if (Properties.Settings.Default.enableCombineTDP == "Enable")
- {
- TDP_Border.Visibility = Visibility.Collapsed;
- }
- else
- {
- TDP1_Border.Visibility = Visibility.Collapsed;
- TDP2_Border.Visibility = Visibility.Collapsed;
- }
- Properties.Settings.Default.showTDP = false;
- TDP_Tile.Background = Brushes.Gray;
- break;
- case "AMD_Toggle":
- AMDGPUCLK_Border.Visibility = Visibility.Collapsed;
- AMD_Tile.Background = Brushes.Gray;
- Properties.Settings.Default.showTDP = false;
- break;
- case "CPU_Toggle":
- MaxCPU_Border.Visibility = Visibility.Collapsed;
- ActiveCores_Border.Visibility = Visibility.Collapsed;
- Properties.Settings.Default.showTDP = false;
- CPU_Tile.Background = Brushes.Gray;
- break;
- case "Display_Toggle":
- Resolution_Border.Visibility = Visibility.Collapsed;
- RefreshRate_Border.Visibility = Visibility.Collapsed;
- Scaling_Border.Visibility = Visibility.Collapsed;
- Properties.Settings.Default.showTDP = false;
- Display_Tile.Background = Brushes.Gray;
- break;
- case "Volume_Toggle":
- Volume_Border.Visibility = Visibility.Collapsed;
- Properties.Settings.Default.showTDP = false;
- Volume_Tile.Background = Brushes.Gray;
- break;
- case "Brightness_Toggle":
- Brightness_Border.Visibility = Visibility.Collapsed;
- Properties.Settings.Default.showTDP = false;
- Brightness_Tile.Background = Brushes.Gray;
- break;
- case "FPSLimit_Toggle":
- FPSLimit_Border.Visibility = Visibility.Collapsed;
- FPSLimit_Tile.Background = Brushes.Gray;
- break;
- case "Profile_Toggle":
- Profile_Border.Visibility = Visibility.Collapsed;
- Profile_Tile.Background = Brushes.Gray;
- break;
- default:
- break;
-
+ case "TDP_Toggle":
+ if (Properties.Settings.Default.enableCombineTDP == "Enable")
+ {
+ TDP_Border.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ TDP1_Border.Visibility = Visibility.Collapsed;
+ TDP2_Border.Visibility = Visibility.Collapsed;
+ }
+ Properties.Settings.Default.showTDP = false;
+ TDP_Tile.Background = Brushes.Gray;
+ break;
+ case "AMD_Toggle":
+ AMDGPUCLK_Border.Visibility = Visibility.Collapsed;
+ AMD_Tile.Background = Brushes.Gray;
+ Properties.Settings.Default.showGPUCLK = false;
+ break;
+ case "CPU_Toggle":
+ MaxCPU_Border.Visibility = Visibility.Collapsed;
+ ActiveCores_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showCPU = false;
+ CPU_Tile.Background = Brushes.Gray;
+ break;
+ case "Display_Toggle":
+ Resolution_Border.Visibility = Visibility.Collapsed;
+ RefreshRate_Border.Visibility = Visibility.Collapsed;
+ Scaling_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showDisplay = false;
+ Display_Tile.Background = Brushes.Gray;
+ break;
+ case "Volume_Toggle":
+ Volume_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showVolume = false;
+ Volume_Tile.Background = Brushes.Gray;
+ break;
+ case "Brightness_Toggle":
+ Brightness_Border.Visibility = Visibility.Collapsed;
+ Properties.Settings.Default.showBrightness = false;
+ Brightness_Tile.Background = Brushes.Gray;
+ break;
+ case "FPSLimit_Toggle":
+ FPSLimit_Border.Visibility = Visibility.Collapsed;
+ FPSLimit_Tile.Background = Brushes.Gray;
+ break;
+ case "Profile_Toggle":
+ Profile_Border.Visibility = Visibility.Collapsed;
+ Profile_Tile.Background = Brushes.Gray;
+ break;
+ default:
+ break;
- }
}
- Properties.Settings.Default.Save();
}
-
-
-
-
+ Properties.Settings.Default.Save();
}
-
private void Button_Click(object sender, RoutedEventArgs e)
@@ -817,14 +848,15 @@ private void handleChangeValues(string sliderName, bool dragStarted, bool dragCo
}
break;
- case "GPUCLK_Slider":
+ case "AMDGPUCLK_Slider":
if (dragStarted) { dragGPUCLK = true; }
else
{
if (dragCompleted) { dragGPUCLK = false; }
if (!dragGPUCLK)
{
-
+ Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.ChangeGPUCLK.ChangeGPUCLK.changeAMDGPUClock((int)sliderValue));
+ AMDGPUCLK_Label.Content = sliderValue.ToString();
}
}
@@ -943,6 +975,50 @@ private void HandleChangingGPUCLK(int gpuclk)
}
}
+
+
+ private void Resolution_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (GlobalVariables.resolution != Resolution_Cbo.SelectedItem && !changingResolution && Resolution_Cbo.SelectedItem != "Custom Scaling")
+ { PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayResolution(Resolution_Cbo.SelectedItem.ToString()); }
+ }
+
+ private void RefreshRate_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (GlobalVariables.refreshRate != RefreshRate_Cbo.SelectedItem && !changingRefreshRate)
+ { PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayRefreshRate(RefreshRate_Cbo.SelectedItem.ToString()); }
+ }
+
+ private void Scaling_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (!changingScaling && Scaling_Cbo.SelectedItem.ToString() != "Default")
+ {
+ changingScaling = true;
+ PowerControlPanel.Classes.ChangeDisplaySettings.ChangeDisplaySettings.SetDisplayScaling(Scaling_Cbo.SelectedItem.ToString());
+ changingScaling = false;
+ }
+
+ }
+ private void Profile_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (!changingProfiles)
+ {
+ if (Profile_Cbo.SelectedValue.ToString() != "None")
+ {
+ PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.applyProfile(Profile_Cbo.SelectedValue.ToString());
+ }
+ else
+ {
+ PowerControlPanel.Classes.ManageXML.ManageXML_Profiles.applyProfile("None");
+ }
+ }
+ }
+ private void FPSLimit_Cbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(FPSLimit_Cbo.SelectedValue.ToString());
+ }
+
+
}
}
diff --git a/PowerControlPanel/Pages/SliderHomePage.xaml.cs b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
index 67e06d3..98c062d 100644
--- a/PowerControlPanel/Pages/SliderHomePage.xaml.cs
+++ b/PowerControlPanel/Pages/SliderHomePage.xaml.cs
@@ -650,15 +650,16 @@ private void cboProfile_SelectionChanged(object sender, SelectionChangedEventArg
}
}
}
+ private void cboFPSLimit_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(cboFPSLimit.SelectedValue.ToString());
+ }
private void Page_Loaded(object sender, RoutedEventArgs e)
{
handleVisibility();
}
- private void cboFPSLimit_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(cboFPSLimit.SelectedValue.ToString());
- }
+
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
diff --git a/PowerControlPanel/Pages/TileHomePage.xaml b/PowerControlPanel/Pages/TileHomePage.xaml
index 9187b02..aad34fc 100644
--- a/PowerControlPanel/Pages/TileHomePage.xaml
+++ b/PowerControlPanel/Pages/TileHomePage.xaml
@@ -279,7 +279,7 @@
-
-
+
\ No newline at end of file
From 8079cee792749b964a6d53be86ee7d3c67dec22c Mon Sep 17 00:00:00 2001
From: project-sbc <78889381+project-sbc@users.noreply.github.com>
Date: Tue, 18 Oct 2022 06:33:20 -0400
Subject: [PATCH 11/11] fixed controller shortcuts when controller is not p1,
fixed gpu clock not displaying the sliding value, fixed slider thumb sizes
not adjusting when hidden
---
MainWindow.xaml.cs | 18 +-
Power Control Panel.csproj | 2 +-
.../Classes/Playnite/Playnite.cs | 17 +-
.../StartUp/Resources/StringResources.xaml | 9 +-
.../Resources/StringResources.zh-Hans.xaml | 25 +-
PowerControlPanel/Classes/Steam/Steam.cs | 17 +-
PowerControlPanel/Pages/HomePage.xaml | 442 ++++------
PowerControlPanel/Pages/HomePage.xaml.cs | 196 +++--
PowerControlPanel/Pages/QAMHomePage.xaml | 756 +++++++++---------
PowerControlPanel/Pages/QAMHomePage.xaml.cs | 79 +-
PowerControlPanel/Pages/SettingsPage.xaml | 66 +-
PowerControlPanel/Pages/SettingsPage.xaml.cs | 14 +-
Properties/Settings.Designer.cs | 20 +-
Properties/Settings.settings | 7 +-
QuickAccessMenu.xaml | 9 +-
QuickAccessMenu.xaml.cs | 5 +
16 files changed, 844 insertions(+), 838 deletions(-)
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 7b92ca3..16b2dbf 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -353,6 +353,10 @@ private void timerTick(object sender, EventArgs e)
getController();
}
}
+ else if (!controller.IsConnected)
+ {
+ getController();
+ }
if (controller != null)
@@ -374,9 +378,17 @@ private void timerTick(object sender, EventArgs e)
{
PowerControlPanel.Classes.EnableFSR.EnableFSR.enableDisableFSR();
}
- if (ButtonComboPress(currentGamepad, Properties.Settings.Default.playniteButtonCombo))
+ if (ButtonComboPress(currentGamepad, Properties.Settings.Default.gameLauncherButtonCombo))
{
- PowerControlPanel.Classes.Playnite.Playnite.playniteToggle();
+ if (Properties.Settings.Default.gameLauncher == "Steam")
+ {
+ PowerControlPanel.Classes.Steam.Steam.openSteamBigPicture();
+ }
+ if (Properties.Settings.Default.gameLauncher == "PlayNite")
+ {
+ PowerControlPanel.Classes.Playnite.Playnite.playniteToggle();
+ }
+
}
//set currentgamepad snapshot to global gamepad for comparison
@@ -581,7 +593,7 @@ void initializeNavigationFrame()
// Navigate to the home page.
- this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/QAMHomePage.xaml", UriKind.RelativeOrAbsolute));
+ this.Loaded += (sender, args) => this.navigationServiceEx.Navigate(new Uri("PowerControlPanel/Pages/HomePage.xaml", UriKind.RelativeOrAbsolute));
}
diff --git a/Power Control Panel.csproj b/Power Control Panel.csproj
index 0bf1d52..2a96b50 100644
--- a/Power Control Panel.csproj
+++ b/Power Control Panel.csproj
@@ -10,7 +10,7 @@
x64
true
Resources\Pictures\PCP.ico
- 0.1.13.0
+ 0.2.2.0
False
diff --git a/PowerControlPanel/Classes/Playnite/Playnite.cs b/PowerControlPanel/Classes/Playnite/Playnite.cs
index d506576..bb328ec 100644
--- a/PowerControlPanel/Classes/Playnite/Playnite.cs
+++ b/PowerControlPanel/Classes/Playnite/Playnite.cs
@@ -13,14 +13,19 @@ public static class Playnite
{
public static void playniteToggle()
{
- if (playniteRunning() && Properties.Settings.Default.directoryPlaynite != "")
+ if (Properties.Settings.Default.directoryPlaynite != "")
{
- RunCLI.RunCommand(" --shutdown", false, Properties.Settings.Default.directoryPlaynite + "\\Playnite.FullscreenApp.exe",6000,false);
- }
- else
- {
- RunCLI.RunCommand(" --startfullscreen", false, Properties.Settings.Default.directoryPlaynite + "\\Playnite.FullscreenApp.exe",6000,false);
+ if (playniteRunning())
+ {
+ RunCLI.RunCommand(" --shutdown", false, Properties.Settings.Default.directoryPlaynite + "\\Playnite.FullscreenApp.exe", 6000, false);
+ }
+ else
+ {
+ RunCLI.RunCommand(" --startfullscreen", false, Properties.Settings.Default.directoryPlaynite + "\\Playnite.FullscreenApp.exe", 6000, false);
+ }
}
+
+
}
public static void setPlayniteDirectory()
{
diff --git a/PowerControlPanel/Classes/StartUp/Resources/StringResources.xaml b/PowerControlPanel/Classes/StartUp/Resources/StringResources.xaml
index 3ce8489..6b5c787 100644
--- a/PowerControlPanel/Classes/StartUp/Resources/StringResources.xaml
+++ b/PowerControlPanel/Classes/StartUp/Resources/StringResources.xaml
@@ -61,6 +61,7 @@
Brightness
Volume
GPU Clock
+ Display
Display Resolution
Display Scaling
Display Refresh
@@ -71,7 +72,9 @@
Intel
PlayNite
Steam
+ Change View Style
+
TDP Settings
CPU Settings
Display Settings
@@ -97,13 +100,17 @@
Main Window Home Page Style (Restart App)
Quick Access Menu Home Page Style
Language/语言
+
+ Steam Directory
+ PlayNite Directory
+
TDP Set Type
Set Max GPU Clock (MHz)
Controller Short Cuts
Quick Access Menu
OSK
FSR
-
+ Game Launcher
Applications
ADD PROFILE
diff --git a/PowerControlPanel/Classes/StartUp/Resources/StringResources.zh-Hans.xaml b/PowerControlPanel/Classes/StartUp/Resources/StringResources.zh-Hans.xaml
index b691a4a..2cb6335 100644
--- a/PowerControlPanel/Classes/StartUp/Resources/StringResources.zh-Hans.xaml
+++ b/PowerControlPanel/Classes/StartUp/Resources/StringResources.zh-Hans.xaml
@@ -62,6 +62,7 @@
亮度
音量
GPU Clock
+ 显示
显示分辨率
显示比例
屏幕刷新率
@@ -72,15 +73,16 @@
Intel
PlayNite
Steam
-
- TDP Settings
- CPU Settings
- Display Settings
- AMD Settings
- Profile Settings
- Volume Settings
- Brightness Settings
- FPS Limit Settings
+ 切换人机界面
+
+ TDP设定
+ CPU设定
+ 显示设定
+ AMD设定
+ Profile设定
+ 音量设定
+ 亮度设定
+ FPS Limit设定
Check For Updates
@@ -97,12 +99,17 @@
Main Window Home Page Style (Restart App)
Quick Acces Mneu Home Page Style
Language/语言
+
+ Steam Directory
+ PlayNite Directory
+
TDP Set Type
Set Max GPU Clock (MHz)
Conroller Short Cuts
Quick Access Menu
OSK
FSR
+ Game Launcher
应用程序
加剖面
diff --git a/PowerControlPanel/Classes/Steam/Steam.cs b/PowerControlPanel/Classes/Steam/Steam.cs
index 1b2d25c..f82a8cc 100644
--- a/PowerControlPanel/Classes/Steam/Steam.cs
+++ b/PowerControlPanel/Classes/Steam/Steam.cs
@@ -25,15 +25,20 @@ public static bool steamRunning()
}
public static void openSteamBigPicture()
{
- if (steamRunning())
+ if (Properties.Settings.Default.directorySteam != "")
{
- RunCLI.RunCommand(" \"steam://open/bigpicture\"",false, Properties.Settings.Default.directorySteam + "\\Steam.exe", 6000, false);
+ if (steamRunning())
+ {
+ RunCLI.RunCommand(" \"steam://open/bigpicture\"", false, Properties.Settings.Default.directorySteam + "\\Steam.exe", 6000, false);
+ }
+ else
+ {
+ RunCLI.RunCommand(" -bigpicture", false, Properties.Settings.Default.directorySteam + "\\Steam.exe", 6000, false);
+ }
}
- else
- {
- RunCLI.RunCommand(" -bigpicture", false, Properties.Settings.Default.directorySteam + "\\Steam.exe", 6000, false);
- }
+
+
}
public static void setSteamDirectory()
diff --git a/PowerControlPanel/Pages/HomePage.xaml b/PowerControlPanel/Pages/HomePage.xaml
index 0ac1df7..5af5c4e 100644
--- a/PowerControlPanel/Pages/HomePage.xaml
+++ b/PowerControlPanel/Pages/HomePage.xaml
@@ -92,7 +92,7 @@
-
+
@@ -111,18 +111,18 @@
-
-
+
+
-
+
-
-
+
+
@@ -131,12 +131,12 @@
-
+
-
+
@@ -146,28 +146,28 @@
-
+
-
-
+
+
-
+
-
+
-
+
-
+
@@ -182,22 +182,22 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -206,279 +206,174 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -486,4 +381,7 @@
+
+
+
diff --git a/PowerControlPanel/Pages/HomePage.xaml.cs b/PowerControlPanel/Pages/HomePage.xaml.cs
index 8521ebd..241925e 100644
--- a/PowerControlPanel/Pages/HomePage.xaml.cs
+++ b/PowerControlPanel/Pages/HomePage.xaml.cs
@@ -74,8 +74,6 @@ public HomePage()
setViewStyle();
- setInitialVisibility();
-
initializeTimer();
loadUpdateValues();
//
@@ -105,14 +103,14 @@ private void loadUpdateValues()
{
if (AMDGPUCLK_Slider.Value != 200) { AMDGPUCLK_Slider.Value = 200; }
AMDGPUCLK_Label.Content = "Default";
- GPUCLK_TileLabel.Content = "GPU Clock: Default";
+ GPUCLK_TileLabel.Content = Application.Current.Resources["TileHomePage_GPUCLK"].ToString() + ": Default";
}
else
{
if (AMDGPUCLK_Slider.Value != Int32.Parse(GlobalVariables.gpuclk))
{
AMDGPUCLK_Slider.Value = Int32.Parse(GlobalVariables.gpuclk);
- GPUCLK_TileLabel.Content = "GPU Clock: " + GlobalVariables.gpuclk + " MHz";
+ GPUCLK_TileLabel.Content = Application.Current.Resources["TileHomePage_GPUCLK"].ToString() + ": " + GlobalVariables.gpuclk + " MHz";
}
}
}
@@ -123,14 +121,14 @@ private void loadUpdateValues()
if (GlobalVariables.cpuMaxFrequency == 0)
{
MAXCPU_Slider.Value = MAXCPU_Slider.Maximum;
- MaxCPU_Label.Content = "Auto";
- MaxCPU_TileLabel.Content = "Max CPU: Auto";
+ MaxCPU_Label.Content = Application.Current.Resources["Auto"].ToString();
+ MaxCPU_TileLabel.Content = Application.Current.Resources["TileHomePage_MaxCPU"].ToString() + ": " + Application.Current.Resources["Auto"].ToString();
}
else
{
MAXCPU_Slider.Value = GlobalVariables.cpuMaxFrequency;
MaxCPU_Label.Content = GlobalVariables.cpuMaxFrequency.ToString();
- MaxCPU_TileLabel.Content = "Max CPU: " + GlobalVariables.cpuMaxFrequency.ToString() + " MHz";
+ MaxCPU_TileLabel.Content = Application.Current.Resources["TileHomePage_MaxCPU"].ToString() + ": " + GlobalVariables.cpuMaxFrequency.ToString() + " MHz";
}
}
@@ -139,7 +137,7 @@ private void loadUpdateValues()
if (!dragActiveCores && Properties.Settings.Default.enableCPU && !GlobalVariables.needActiveCoreRead)
{
ActiveCores_Slider.Value = GlobalVariables.cpuActiveCores;
- ActiveCores_TileLabel.Content = "Active Cores: " + GlobalVariables.cpuActiveCores;
+ ActiveCores_TileLabel.Content = Application.Current.Resources["TileHomePage_ActiveCores"].ToString() + ": " + GlobalVariables.cpuActiveCores;
}
//profile
@@ -210,8 +208,8 @@ private void loadUpdateValues()
{
if (GlobalVariables.readPL1 > 0 && GlobalVariables.readPL2 > 0)
{
- TDP1_TileLabel.Content = "Sustained TDP: " + GlobalVariables.readPL1 + " W";
- TDP2_TileLabel.Content = "Boost TDP: " + GlobalVariables.readPL2 + " W";
+ TDP1_TileLabel.Content = Application.Current.Resources["TileHomePage_TDPSustained"].ToString() + ": " + GlobalVariables.readPL1 + " W";
+ TDP2_TileLabel.Content = Application.Current.Resources["TileHomePage_TDPBoost"].ToString() + ": " + GlobalVariables.readPL2 + " W";
changingTDP = true;
updateFromGlobalTDPPL1();
updateFromGlobalTDPPL2();
@@ -281,37 +279,42 @@ private void hideDisabledItems()
//set enable/disable
if (!Properties.Settings.Default.enableDisplay)
{
- Display_GroupBorder.Visibility = Visibility.Collapsed;
+ Resolution_Border.Visibility = Visibility.Collapsed;
+ RefreshRate_Border.Visibility = Visibility.Collapsed;
+ Scaling_Border.Visibility = Visibility.Collapsed;
Display_Tile.Visibility = Visibility.Collapsed;
}
if (!Properties.Settings.Default.enableCPU)
{
- CPU_GroupBorder.Visibility = Visibility.Collapsed;
+ MaxCPU_Border.Visibility = Visibility.Collapsed;
+ ActiveCores_Border.Visibility = Visibility.Collapsed;
CPU_Tile.Visibility = Visibility.Collapsed;
}
if (!Properties.Settings.Default.enableVolume)
{
- Volume_GroupBorder.Visibility = Visibility.Collapsed;
+ Volume_Border.Visibility = Visibility.Collapsed;
Volume_Tile.Visibility = Visibility.Collapsed;
}
if (!Properties.Settings.Default.enableBrightness)
{
- Brightness_GroupBorder.Visibility = Visibility.Collapsed;
+ Brightness_Border.Visibility = Visibility.Collapsed;
Brightness_Tile.Visibility = Visibility.Collapsed;
}
if (!Properties.Settings.Default.enableTDP)
{
- TDP_GroupBorder.Visibility = Visibility.Collapsed;
+ TDP_Border.Visibility = Visibility.Collapsed;
+ TDP1_Border.Visibility = Visibility.Collapsed;
+ TDP2_Border.Visibility = Visibility.Collapsed;
TDP_Tile.Visibility = Visibility.Collapsed;
}
if (!Properties.Settings.Default.enableGPUCLK)
{
- AMD_GroupBorder.Visibility = Visibility.Collapsed;
+ AMDGPUCLK_Border.Visibility = Visibility.Collapsed;
AMD_Tile.Visibility = Visibility.Collapsed;
}
@@ -383,71 +386,33 @@ private void setComboBoxItemSource()
private void setViewStyle()
{
-
-
- //set by view style
- if (Properties.Settings.Default.homePageTypeQAM == "Tile")
- {
- removeGroupSliderBoxAndBorder();
- }
- if (Properties.Settings.Default.homePageTypeQAM == "Slider")
+ if (this.Title == "QAMHomePage")
{
- removeGroupSliderBoxAndBorder();
- wrapPanel.Visibility = Visibility.Collapsed;
+ //set by view style
+ if (Properties.Settings.Default.homePageTypeQAM == "Tile")
+ {
+ //removeGroupSliderBoxAndBorder();
+ }
+ if (Properties.Settings.Default.homePageTypeQAM == "Slider")
+ {
+ //removeGroupSliderBoxAndBorder();
+ wrapPanel.Visibility = Visibility.Collapsed;
+ }
+ if (Properties.Settings.Default.homePageTypeQAM == "Group Slider")
+ {
+ wrapPanel.Visibility = Visibility.Collapsed;
+ }
}
- if (Properties.Settings.Default.homePageTypeQAM == "Group Slider")
+ else
{
- wrapPanel.Visibility = Visibility.Collapsed;
+ //removeGroupSliderBoxAndBorder();
+ rdViewChange.Height = new GridLength(0);
+ borderChangeViewStyle.Visibility = Visibility.Collapsed;
}
- }
-
- private void resetView()
- {
- AMD_BoxHeader.Visibility = Visibility.Visible;
- Brightness_BoxHeader.Visibility = Visibility.Visible;
- CPU_BoxHeader.Visibility = Visibility.Visible;
- Display_BoxHeader.Visibility = Visibility.Visible;
- FPSLimit_BoxHeader.Visibility = Visibility.Visible;
- Profile_BoxHeader.Visibility = Visibility.Visible;
- TDP_BoxHeader.Visibility = Visibility.Visible;
- Volume_BoxHeader.Visibility = Visibility.Visible;
-
- wrapPanel.Visibility = Visibility.Visible;
-
- TDP_GroupBorder.BorderThickness = new Thickness(3);
- CPU_GroupBorder.BorderThickness = new Thickness(3);
- Display_GroupBorder.BorderThickness = new Thickness(3);
- Volume_GroupBorder.BorderThickness = new Thickness(3);
- Brightness_GroupBorder.BorderThickness = new Thickness(3);
- Profile_GroupBorder.BorderThickness = new Thickness(3);
- AMD_GroupBorder.BorderThickness = new Thickness(3);
- FPSLimit_GroupBorder.BorderThickness = new Thickness(3);
-
-
}
- private void removeGroupSliderBoxAndBorder()
- {
- //get rid of border and box headers
- TDP_GroupBorder.BorderThickness = new Thickness(0);
- CPU_GroupBorder.BorderThickness = new Thickness(0);
- Display_GroupBorder.BorderThickness = new Thickness(0);
- Volume_GroupBorder.BorderThickness = new Thickness(0);
- Brightness_GroupBorder.BorderThickness = new Thickness(0);
- Profile_GroupBorder.BorderThickness = new Thickness(0);
- AMD_GroupBorder.BorderThickness = new Thickness(0);
- FPSLimit_GroupBorder.BorderThickness = new Thickness(0);
- AMD_BoxHeader.Visibility = Visibility.Collapsed;
- Brightness_BoxHeader.Visibility = Visibility.Collapsed;
- CPU_BoxHeader.Visibility = Visibility.Collapsed;
- Display_BoxHeader.Visibility = Visibility.Collapsed;
- FPSLimit_BoxHeader.Visibility = Visibility.Collapsed;
- Profile_BoxHeader.Visibility = Visibility.Collapsed;
- TDP_BoxHeader.Visibility = Visibility.Collapsed;
- Volume_BoxHeader.Visibility = Visibility.Collapsed;
- }
private void setInitialVisibility()
{
@@ -459,27 +424,32 @@ private void setInitialVisibility()
if (!Properties.Settings.Default.showTDP && Properties.Settings.Default.enableTDP)
{
handleToggleControls("TDP_Toggle", false);
+
}
if (!Properties.Settings.Default.showDisplay && Properties.Settings.Default.enableDisplay)
{
handleToggleControls("Display_Toggle", false);
+
}
if (!Properties.Settings.Default.showCPU && Properties.Settings.Default.enableCPU)
{
handleToggleControls("CPU_Toggle", false);
+
}
if (!Properties.Settings.Default.showVolume && Properties.Settings.Default.enableVolume)
{
handleToggleControls("Volume_Toggle", false);
+
}
if (!Properties.Settings.Default.showBrightness && Properties.Settings.Default.enableBrightness)
{
handleToggleControls("Brightness_Toggle", false);
+
}
@@ -488,6 +458,7 @@ private void setInitialVisibility()
if (!Properties.Settings.Default.showGPUCLK && Properties.Settings.Default.enableGPUCLK)
{
handleToggleControls("AMD_Toggle", false);
+
}
@@ -500,9 +471,31 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
{
//set height of scrollviewer
//sliderScrollViewer.Height = this.ActualHeight - wrapPanel.ActualHeight;
+ setSliderThumbSizes();
+
setInitialVisibility();
}
+ private void setSliderThumbSizes()
+ {
+ setThumbSize(ActiveCores_Slider);
+ setThumbSize(AMDGPUCLK_Slider);
+ setThumbSize(Brightness_Slider);
+ setThumbSize(MAXCPU_Slider);
+ setThumbSize(TDP1_Slider);
+ setThumbSize(TDP2_Slider);
+ setThumbSize(TDP_Slider);
+ setThumbSize(Volume_Slider);
+ }
+ private bool isTileGray(Tile tile)
+ {
+ if (tile.Background == Brushes.Gray)
+ {
+ return true;
+ }
+ else
+ { return false; }
+ }
private void Tile_Click(object sender, RoutedEventArgs e)
{
@@ -513,28 +506,29 @@ private void Tile_Click(object sender, RoutedEventArgs e)
switch (tileName)
{
case "TDP_Tile":
- TDP_Toggle.IsOn = !TDP_Toggle.IsOn;
+ handleToggleControls("TDP_Toggle", isTileGray(TDP_Tile));
+
break;
case "Volume_Tile":
- Volume_Toggle.IsOn = !Volume_Toggle.IsOn;
+ handleToggleControls("Volume_Toggle", isTileGray(Volume_Tile));
break;
case "Brightness_Tile":
- Brightness_Toggle.IsOn = !Brightness_Toggle.IsOn;
+ handleToggleControls("Brightness_Toggle", isTileGray(Brightness_Tile));
break;
case "Display_Tile":
- Display_Toggle.IsOn = !Display_Toggle.IsOn;
+ handleToggleControls("Display_Toggle", isTileGray(Display_Tile));
break;
case "CPU_Tile":
- CPU_Toggle.IsOn = !CPU_Toggle.IsOn;
+ handleToggleControls("CPU_Toggle", isTileGray(CPU_Tile));
break;
case "AMD_Tile":
- AMD_Toggle.IsOn = !AMD_Toggle.IsOn;
+ handleToggleControls("AMD_Toggle", isTileGray(AMD_Tile));
break;
case "Profile_Tile":
- Profile_Toggle.IsOn = !Profile_Toggle.IsOn;
+ handleToggleControls("Profile_Toggle", isTileGray(Profile_Tile));
break;
case "FPSLimit_Tile":
- FPSLimit_Toggle.IsOn = !FPSLimit_Toggle.IsOn;
+ handleToggleControls("FPSLimit_Toggle", isTileGray(FPSLimit_Tile));
break;
case "Steam_Tile":
PowerControlPanel.Classes.Steam.Steam.openSteamBigPicture();
@@ -550,23 +544,7 @@ private void Tile_Click(object sender, RoutedEventArgs e)
}
- private void Slider_Loaded(object sender, RoutedEventArgs e)
- {
- //set thumb size, internet routine
- var SliderThumb = GetElementFromParent(sender as DependencyObject, "HorizontalThumb"); //Make sure to put the right name for your slider layout options are: ("VerticalThumb", "HorizontalThumb")
- if (SliderThumb != null)
- {
-
- if (SliderThumb is Thumb thumb)
- {
-
- thumb.Width = 25;
- thumb.Height = 35;
- }
- else { }
- }
- else { }
- }
+
private DependencyObject GetElementFromParent(DependencyObject parent, string childname)
@@ -752,7 +730,7 @@ private void Button_Click(object sender, RoutedEventArgs e)
}
Properties.Settings.Default.Save();
- resetView();
+
setViewStyle();
}
@@ -835,14 +813,16 @@ private void handleChangeValues(string sliderName, bool dragStarted, bool dragCo
}
break;
case "AMDGPUCLK_Slider":
+
if (dragStarted) { dragGPUCLK = true; }
else
{
if (dragCompleted) { dragGPUCLK = false; }
+ AMDGPUCLK_Label.Content = sliderValue.ToString();
if (!dragGPUCLK)
{
Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.ChangeGPUCLK.ChangeGPUCLK.changeAMDGPUClock((int)sliderValue));
- AMDGPUCLK_Label.Content = sliderValue.ToString();
+
}
}
@@ -1004,7 +984,23 @@ private void FPSLimit_Cbo_SelectionChanged(object sender, SelectionChangedEventA
PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(FPSLimit_Cbo.SelectedValue.ToString());
}
+ private void setThumbSize(Slider slider)
+ {
+ //set thumb size, internet routine
+ var SliderThumb = GetElementFromParent(slider as DependencyObject, "HorizontalThumb"); //Make sure to put the right name for your slider layout options are: ("VerticalThumb", "HorizontalThumb")
+ if (SliderThumb != null)
+ {
+ if (SliderThumb is Thumb thumb)
+ {
+
+ thumb.Width = 25;
+ thumb.Height = 35;
+ }
+ else { }
+ }
+ else { }
+ }
}
}
diff --git a/PowerControlPanel/Pages/QAMHomePage.xaml b/PowerControlPanel/Pages/QAMHomePage.xaml
index 7c89d5c..61edf31 100644
--- a/PowerControlPanel/Pages/QAMHomePage.xaml
+++ b/PowerControlPanel/Pages/QAMHomePage.xaml
@@ -90,396 +90,400 @@
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/PowerControlPanel/Pages/QAMHomePage.xaml.cs b/PowerControlPanel/Pages/QAMHomePage.xaml.cs
index b7b4d27..f0e0a8c 100644
--- a/PowerControlPanel/Pages/QAMHomePage.xaml.cs
+++ b/PowerControlPanel/Pages/QAMHomePage.xaml.cs
@@ -68,13 +68,14 @@ public QAMHomePage()
//set values
loadUpdateValues();
+
+
//set intial visibility (to remove disabled stuff)
hideDisabledItems();
setViewStyle();
- setInitialVisibility();
initializeTimer();
loadUpdateValues();
@@ -82,7 +83,17 @@ public QAMHomePage()
}
-
+ private void setSliderThumbSizes()
+ {
+ setThumbSize(ActiveCores_Slider);
+ setThumbSize(AMDGPUCLK_Slider);
+ setThumbSize(Brightness_Slider);
+ setThumbSize(MAXCPU_Slider);
+ setThumbSize(TDP1_Slider);
+ setThumbSize(TDP2_Slider);
+ setThumbSize(TDP_Slider);
+ setThumbSize(Volume_Slider);
+ }
private void initializeTimer()
{
timer.Interval = new TimeSpan(0, 0, 3);
@@ -182,15 +193,26 @@ private void loadUpdateValues()
if (PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.rtssRunning())
{
- FPSLimit_Cbo.Text = GlobalVariables.FPSLimit;
- FPSLimit_TileLabel.Content = GlobalVariables.FPSLimit;
- FPSLimit_Tile.Visibility=Visibility.Visible;
- FPSLimit_Border.Visibility = Visibility.Visible;
+ if (FPSLimit_GroupBorder.Visibility == Visibility.Collapsed)
+ {
+ FPSLimit_GroupBorder.Visibility = Visibility.Visible;
+ FPSLimit_Tile.Visibility=Visibility.Visible;
+ FPSLimit_Cbo.Text = GlobalVariables.FPSLimit;
+ FPSLimit_TileLabel.Content = GlobalVariables.FPSLimit;
+ FPSLimit_Border.Visibility = Visibility.Visible;
+
+ }
+ else
+ {
+ FPSLimit_Cbo.Text = GlobalVariables.FPSLimit;
+ FPSLimit_TileLabel.Content = GlobalVariables.FPSLimit;
+ }
+
}
else
{
FPSLimit_Tile.Visibility = Visibility.Collapsed;
- FPSLimit_Border.Visibility = Visibility.Collapsed;
+ FPSLimit_GroupBorder.Visibility = Visibility.Collapsed;
}
@@ -514,8 +536,12 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
{
//set height of scrollviewer
//sliderScrollViewer.Height = this.ActualHeight - wrapPanel.ActualHeight;
+ //set thumb size
+ setSliderThumbSizes();
+
setInitialVisibility();
+
}
private void Tile_Click(object sender, RoutedEventArgs e)
@@ -564,23 +590,7 @@ private void Tile_Click(object sender, RoutedEventArgs e)
}
- private void Slider_Loaded(object sender, RoutedEventArgs e)
- {
- //set thumb size, internet routine
- var SliderThumb = GetElementFromParent(sender as DependencyObject, "HorizontalThumb"); //Make sure to put the right name for your slider layout options are: ("VerticalThumb", "HorizontalThumb")
- if (SliderThumb != null)
- {
-
- if (SliderThumb is Thumb thumb)
- {
-
- thumb.Width = 25;
- thumb.Height = 35;
- }
- else { }
- }
- else { }
- }
+
private DependencyObject GetElementFromParent(DependencyObject parent, string childname)
@@ -852,11 +862,12 @@ private void handleChangeValues(string sliderName, bool dragStarted, bool dragCo
if (dragStarted) { dragGPUCLK = true; }
else
{
+ AMDGPUCLK_Label.Content = sliderValue.ToString();
if (dragCompleted) { dragGPUCLK = false; }
if (!dragGPUCLK)
{
Classes.TaskScheduler.TaskScheduler.runTask(() => PowerControlPanel.Classes.ChangeGPUCLK.ChangeGPUCLK.changeAMDGPUClock((int)sliderValue));
- AMDGPUCLK_Label.Content = sliderValue.ToString();
+
}
}
@@ -1018,7 +1029,25 @@ private void FPSLimit_Cbo_SelectionChanged(object sender, SelectionChangedEventA
PowerControlPanel.Classes.ChangeFPSLimit.ChangeFPSLimit.changeLimit(FPSLimit_Cbo.SelectedValue.ToString());
}
+ private void setThumbSize(Slider slider)
+ {
+ //set thumb size, internet routine
+ var SliderThumb = GetElementFromParent(slider as DependencyObject, "HorizontalThumb"); //Make sure to put the right name for your slider layout options are: ("VerticalThumb", "HorizontalThumb")
+ if (SliderThumb != null)
+ {
+ if (SliderThumb is Thumb thumb)
+ {
+
+ thumb.Width = 25;
+ thumb.Height = 35;
+ }
+ else { }
+ }
+ else { }
+ }
}
+
+
}
diff --git a/PowerControlPanel/Pages/SettingsPage.xaml b/PowerControlPanel/Pages/SettingsPage.xaml
index 9a05c6f..bdcb64f 100644
--- a/PowerControlPanel/Pages/SettingsPage.xaml
+++ b/PowerControlPanel/Pages/SettingsPage.xaml
@@ -45,8 +45,10 @@
+
+
@@ -56,7 +58,8 @@
-
+
+
@@ -125,22 +128,9 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -152,7 +142,7 @@
-
+
-
+
+
-
-
-
+
+
+
-
-
-
+
-
+
+
+
+
+
+
+
+
@@ -292,10 +288,12 @@
+
+
@@ -311,6 +309,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerControlPanel/Pages/SettingsPage.xaml.cs b/PowerControlPanel/Pages/SettingsPage.xaml.cs
index 51a061f..a09c48a 100644
--- a/PowerControlPanel/Pages/SettingsPage.xaml.cs
+++ b/PowerControlPanel/Pages/SettingsPage.xaml.cs
@@ -4,6 +4,7 @@
using Microsoft.Win32.TaskScheduler;
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Text;
@@ -97,11 +98,15 @@ private void btnSave_Click(object sender, RoutedEventArgs e)
Properties.Settings.Default.homePageTypeMW = cboMWHomePageStyle.Text;
- Properties.Settings.Default.homePageTypeQAM = cboQAMHomePageStyle.Text;
+
+ Properties.Settings.Default.directorySteam = txtbxSteamDirectory.Text;
+ Properties.Settings.Default.directoryPlaynite = txtbxPlayNiteDirectory.Text;
Properties.Settings.Default.fsrButtonCombo = txtbxShortCutFSR.Text.Replace(" ","");
Properties.Settings.Default.qamButtonCombo = txtbxShortCutQAM.Text.Replace(" ", "");
Properties.Settings.Default.oskButtonCombo = txtbxShortCutOSK.Text.Replace(" ", "");
+ Properties.Settings.Default.gameLauncherButtonCombo = txtbxShortCutGameLauncher.Text.Replace(" ", "");
+ Properties.Settings.Default.gameLauncher = cboGameLauncher.Text;
//Save
Properties.Settings.Default.Save();
@@ -144,12 +149,16 @@ private void loadSettings()
cboLanguage.Text = Properties.Settings.Default.Language;
cboMWHomePageStyle.Text = Properties.Settings.Default.homePageTypeMW;
- cboQAMHomePageStyle.Text = Properties.Settings.Default.homePageTypeQAM;
+ txtbxPlayNiteDirectory.Text = Properties.Settings.Default.directoryPlaynite;
+ txtbxSteamDirectory.Text = Properties.Settings.Default.directorySteam;
+
cboTDPTypeIntel.Text = Properties.Settings.Default.IntelMMIOMSR;
txtbxShortCutFSR.Text = Properties.Settings.Default.fsrButtonCombo;
txtbxShortCutOSK.Text = Properties.Settings.Default.oskButtonCombo;
txtbxShortCutQAM.Text = Properties.Settings.Default.qamButtonCombo;
+ txtbxShortCutGameLauncher.Text = Properties.Settings.Default.gameLauncherButtonCombo;
+ cboGameLauncher.Text = Properties.Settings.Default.gameLauncher;
}
@@ -207,6 +216,7 @@ private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
{
if (args.Error == null)
{
+
if (args.IsUpdateAvailable)
{
DialogResult dialogResult;
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
index 8e61718..33dc2e2 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -349,13 +349,13 @@ public bool upgradeSettingsRequired {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("LB+DPadUp")]
- public string playniteButtonCombo {
+ [global::System.Configuration.DefaultSettingValueAttribute("LB+RB+DPadUp")]
+ public string gameLauncherButtonCombo {
get {
- return ((string)(this["playniteButtonCombo"]));
+ return ((string)(this["gameLauncherButtonCombo"]));
}
set {
- this["playniteButtonCombo"] = value;
+ this["gameLauncherButtonCombo"] = value;
}
}
@@ -406,5 +406,17 @@ public string directoryPlaynite {
this["directoryPlaynite"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string gameLauncher {
+ get {
+ return ((string)(this["gameLauncher"]));
+ }
+ set {
+ this["gameLauncher"] = value;
+ }
+ }
}
}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
index e55729b..1ea1500 100644
--- a/Properties/Settings.settings
+++ b/Properties/Settings.settings
@@ -83,8 +83,8 @@
True
-
- LB+DPadUp
+
+ LB+RB+DPadUp
True
@@ -98,5 +98,8 @@
+
+
+
\ No newline at end of file
diff --git a/QuickAccessMenu.xaml b/QuickAccessMenu.xaml
index 59feb16..dac35de 100644
--- a/QuickAccessMenu.xaml
+++ b/QuickAccessMenu.xaml
@@ -110,11 +110,14 @@
-
-
+
+
-
+
+
+
diff --git a/QuickAccessMenu.xaml.cs b/QuickAccessMenu.xaml.cs
index 8228619..4cf5afb 100644
--- a/QuickAccessMenu.xaml.cs
+++ b/QuickAccessMenu.xaml.cs
@@ -271,5 +271,10 @@ void updateValues()
//game pad stuff here
//if (GlobalVariables.controller is null) { txtblkGamepad.Text = ""; } else { if (GlobalVariables.controller.IsConnected) { txtblkGamepad.Text = "\uE7FC"; } else { txtblkGamepad.Text = ""; } }
}
+
+ private void Close_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
}
}
\ No newline at end of file