private void SetState(NativeMethods.ExecutionState state, bool enable)
        {
            if (enable)
            {
                _current |= state;
            }
            else
            {
                _current &= ~state;
            }

            try
            {
                if (IsEnabled)
                {
                    NativeMethods.SetThreadExecutionState(_current);
                }
            }
            catch (System.MethodAccessException)
            {
                // TODO: Bubble up to errors collection.
            }
        }
 private bool GetState(NativeMethods.ExecutionState state)
 {
     return (_current & state) != 0;
 }