コード例 #1
0
ファイル: PowerManager.cs プロジェクト: kiranksm2/wpf_charts
 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");
 }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
ファイル: PowerManager.cs プロジェクト: kiranksm2/wpf_charts
 public void SetActive(PowerPlan plan)
 {
     PowerSetActiveScheme(IntPtr.Zero, ref plan.Guid);
 }
コード例 #5
0
 protected bool Equals(PowerPlan other)
 {
     return(string.Equals(Name, other.Name) && Guid.Equals(other.Guid));
 }