Beispiel #1
0
        protected override void OnStart(string[] args)
        {
            try
            {
                var guidPlans = PowerHelpers.GetAll();
                _balancedGuid = guidPlans.FirstOrDefault(g => PowerHelpers.ReadFriendlyName(g) == "Balanced");

                Timer timScheduledTask = new Timer();
                timScheduledTask.Interval = 60 * 1000;
                timScheduledTask.Enabled  = true;
                timScheduledTask.Elapsed += timScheduledTask_Elapsed;
            }
            catch
            {
            }
        }
Beispiel #2
0
 void timScheduledTask_Elapsed(object sender, ElapsedEventArgs e)
 {
     PowerHelpers.PowerSetActiveScheme(IntPtr.Zero, ref _balancedGuid);
 }