Example #1
0
            public ConsolePowerEventArguments(PowerModes powerMode)
            {
                switch (powerMode)
                {
                case PowerModes.Resume:
                    _eventCode = PowerEventCode.ResumeAutomatic;
                    break;

                case PowerModes.StatusChange:
                    _eventCode = PowerEventCode.PowerStatusChange;
                    break;

                case PowerModes.Suspend:
                    _eventCode = PowerEventCode.Suspend;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(powerMode), powerMode, null);
                }
            }
 public WindowsPowerEventArguments(PowerBroadcastStatus powerStatus)
 {
     _eventCode = (PowerEventCode)Enum.ToObject(typeof(PowerEventCode), (int)powerStatus);
 }
Example #3
0
 public ConsolePowerEventArguments(PowerModes powerMode)
 {
     switch (powerMode)
     {
         case PowerModes.Resume:
             _eventCode = PowerEventCode.ResumeAutomatic;
             break;
         case PowerModes.StatusChange:
             _eventCode = PowerEventCode.PowerStatusChange;
             break;
         case PowerModes.Suspend:
             _eventCode = PowerEventCode.Suspend;
             break;
         default:
             throw new ArgumentOutOfRangeException(nameof(powerMode), powerMode, null);
     }
 }
Example #4
0
 public WindowsPowerEventArguments(PowerBroadcastStatus powerStatus)
 {
     _eventCode = (PowerEventCode) Enum.ToObject(typeof(PowerEventCode), (int)powerStatus);
 }