Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesCJ60 committed Dec 15, 2022
1 parent dc99198 commit dc48ac2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
Expand Down
20 changes: 20 additions & 0 deletions Windows/OverlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using UXTU.Scripts.Adpative_Modes.Performance;
using AATUV3.Scripts.SMU_Backend_Scripts;
using MessageBox = System.Windows.MessageBox;
using Microsoft.Win32;

namespace AATUV3
{
Expand Down Expand Up @@ -129,10 +130,29 @@ void Adaptive_Tick(object sender, EventArgs e)
CpuPowerLimiter.CurveOptimiserLimit(cpuLoad, maxCO);
}
}
SystemEvents.PowerModeChanged += OnPowerChange;
}
catch { }
}

private void OnPowerChange(object s, PowerModeChangedEventArgs e)
{
switch (e.Mode)
{
case PowerModes.Resume:
// Restart and run as admin
var exeName = Process.GetCurrentProcess().MainModule.FileName;
ProcessStartInfo startInfo = new ProcessStartInfo(exeName);
startInfo.Verb = "runas";
startInfo.Arguments = "restart";
Process.Start(startInfo);
this.Close();
break;
case PowerModes.Suspend:
break;
}
}

public int cpuLoad = 0;

void AutoReapply_Tick(object sender, EventArgs e)
Expand Down

0 comments on commit dc48ac2

Please sign in to comment.