public void RunCommand(TrayCommandType commandType)
        {
            switch (commandType)
            {
            case TrayCommandType.Hibernate:
                Application.SetSuspendState(PowerState.Hibernate, true, true);
                break;

            case TrayCommandType.Shutdown:
                Process.Start("shutdown", "/s /t 0");
                break;

            case TrayCommandType.Suspend:
                Application.SetSuspendState(PowerState.Suspend, true, true);
                break;

            case TrayCommandType.TurnScreenOff:
                SendMessage(
                    (IntPtr)0xffff,     // HWND_BROADCAST
                    0x0112,             // WM_SYSCOMMAND
                    (IntPtr)0xf170,     // SC_MONITORPOWER
                    (IntPtr)0x0002      // POWER_OFF
                    );
                break;

            case TrayCommandType.ForceShutdown:
                Process.Start("shutdown", "/s /f /t 10");
                break;
            }
        }
        public async Task ProcessRequestAsync_No_Secret(string commandText, TrayCommandType command)
        {
            // Arrange
            _mocker.GetMock <ITrayCommandHelper>().Setup(x => x.GetCommandType(commandText)).Returns(command);

            // Act
            await _hostHelper.ProcessRequestAsync($"/{commandText}").ConfigureAwait(false);

            // Assert
            _mocker.Verify <ITrayCommandHelper>(x => x.RunCommand(command), Times.Once);
        }
        public void RunCommand(TrayCommandType commandType)
        {
            switch (commandType)
            {
            case TrayCommandType.Hibernate:
                Application.SetSuspendState(PowerState.Hibernate, true, true);
                break;

            case TrayCommandType.Shutdown:
                Process.Start("shutdown", "/s /t 0");
                break;

            case TrayCommandType.Suspend:
                Application.SetSuspendState(PowerState.Suspend, true, true);
                break;
            }
        }
 public string GetText(TrayCommandType commandType)
 {
     return(Commands.SingleOrDefault(c => c.CommandType == commandType)?.Name);
 }