-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShutdownCommand.cs
More file actions
64 lines (55 loc) · 1.75 KB
/
ShutdownCommand.cs
File metadata and controls
64 lines (55 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//-------------------------------------------------------------------
// Copyright © 2012 Kindel Systems, LLC
// http://www.kindel.com
// charlie@kindel.com
//
// Published under the MIT License.
// Source control on SourceForge
// http://sourceforge.net/projects/mcecontroller/
//-------------------------------------------------------------------
using System;
using System.Xml.Serialization;
namespace MCEControl
{
/// <summary>
/// Summary description for ShutdownCommand.
/// </summary>
public class ShutdownCommand : Command
{
[XmlAttribute("Type")]
public string Type;
public ShutdownCommand()
{
// Serialzable, must have constructor
}
public ShutdownCommand(string type)
{
Type = type;
}
public override void Execute(Reply reply)
{
MainWindow.AddLogEntry("Cmd: ShutdownCommand: " + Type);
using (var sc = new SystemControl())
{
switch (Type.ToLower())
{
case "shutdown":
sc.Shutdown("MCE Controller Shutdown", 3, true, false);
break;
case "restart":
sc.Shutdown("MCE Controller Restart", 3, true, true);
break;
case "standby":
sc.Standby();
break;
case "hibernate":
sc.Hibernate();
break;
case "abort":
sc.Abort();
break;
}
}
}
}
}