Exemplo n.º 1
0
        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.
            }
        }
Exemplo n.º 2
0
 private bool GetState(NativeMethods.ExecutionState state)
 {
     return (_current & state) != 0;
 }