public PowerManager() { // See GUID values in WinNT.h. MaximumPerformance = NewPlan("8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"); Balanced = NewPlan("381b4222-f694-41f0-9685-ff5bb260df2e"); PowerSourceOptimized = NewPlan("a1841308-3541-4fab-bc81-f71556f20b4a"); }
private FeaturesHelper() { _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromSeconds(1); _timer.Tick += (s, e) => { var currentPlan = _powerManager.GetCurrentPlan(); if (_lastPlan != currentPlan) { OnPropertyChanged("PowerSavingHighPerformance"); OnPropertyChanged("PowerSavingBalanced"); OnPropertyChanged("PowerSavingUnknown"); OnPropertyChanged("PowerSavingPowerSaver"); _lastPlan = currentPlan; } }; _timer.Start(); }
private FeaturesHelper() { var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; timer.Tick += (s, e) => { var currentPlan = _powerManager.GetCurrentPlan(); if (_lastPlan == null || !_lastPlan.Equals(currentPlan)) { OnPropertyChanged(nameof(PowerSavingHighPerformance)); OnPropertyChanged(nameof(PowerSavingBalanced)); OnPropertyChanged(nameof(PowerSavingUnknown)); OnPropertyChanged(nameof(PowerSavingPowerSaver)); _lastPlan = currentPlan; } }; timer.Start(); }
public void SetActive(PowerPlan plan) { PowerSetActiveScheme(IntPtr.Zero, ref plan.Guid); }
protected bool Equals(PowerPlan other) { return(string.Equals(Name, other.Name) && Guid.Equals(other.Guid)); }