Merge pull request #109 from m4rkireland/develop

Add Hibernate Command
pull/115/head
sleevezipper 3 years ago committed by GitHub
commit 21d38381fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -112,6 +112,12 @@ namespace UserInterface.Views
item.ShowCommandInput = false;
item.ShowKeyInput = false;
break;
case AvailableCommands.HibernateCommand:
item.Description = "This command hibernates the PC immediately. ";
item.MoreInfoLink = "https://github.com/sleevezipper/hass-workstation-service/blob/master/documentation/Commands.md#hibernatecommand";
item.ShowCommandInput = false;
item.ShowKeyInput = false;
break;
case AvailableCommands.LogOffCommand:
item.Description = "This command logs the current user off immediately. ";
item.MoreInfoLink = "https://github.com/sleevezipper/hass-workstation-service/blob/master/documentation/Commands.md#logoffcommand";

@ -10,6 +10,10 @@ This command shuts down the computer immediately. It runs `shutdown /s`.
This command restarts the computer immediately. It runs `shutdown /r`.
### HibernateCommand
This command hibernates the computer immediately. It runs `shutdown /h`.
### LogOffCommand
This command logs off the current user. It runs `shutdown /l`.

@ -201,6 +201,7 @@ namespace hass_workstation_service.Communication.InterProcesCommunication
{
AvailableCommands.ShutdownCommand => new ShutdownCommand(_publisher, model.Name),
AvailableCommands.RestartCommand => new RestartCommand(_publisher, model.Name),
AvailableCommands.HibernateCommand => new HibernateCommand(_publisher, model.Name),
AvailableCommands.LogOffCommand => new LogOffCommand(_publisher, model.Name),
AvailableCommands.CustomCommand => new CustomCommand(_publisher, model.Command, model.Name),
AvailableCommands.PlayPauseCommand => new PlayPauseCommand(_publisher, model.Name),

@ -110,6 +110,7 @@ namespace hass_workstation_service.Communication.InterProcesCommunication.Models
ShutdownCommand,
LogOffCommand,
RestartCommand,
HibernateCommand,
KeyCommand,
PlayPauseCommand,
NextCommand,

@ -190,6 +190,9 @@ namespace hass_workstation_service.Data
case "RestartCommand":
command = new RestartCommand(publisher, configuredCommand.Name, configuredCommand.Id);
break;
case "HibernateCommand":
command = new HibernateCommand(publisher, configuredCommand.Name, configuredCommand.Id);
break;
case "LogOffCommand":
command = new LogOffCommand(publisher, configuredCommand.Name, configuredCommand.Id);
break;

@ -0,0 +1,17 @@
using hass_workstation_service.Communication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace hass_workstation_service.Domain.Commands
{
public class HibernateCommand : CustomCommand
{
public HibernateCommand(MqttPublisher publisher, string name = "Hibernate", Guid id = default(Guid)) : base(publisher, "shutdown /h", name ?? "Hibernate", id)
{
this.State = "OFF";
}
}
}
Loading…
Cancel
Save