mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-27 19:34:51 +00:00
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using Crestron.SimplSharp;
|
|
using Crestron.SimplSharp.WebScripting;
|
|
using Newtonsoft.Json;
|
|
using PepperDash.Core;
|
|
using PepperDash.Core.Web.RequestHandlers;
|
|
|
|
namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
|
{
|
|
public class RestartProgramRequestHandler : WebApiBaseRequestHandler
|
|
{
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// base(true) enables CORS support by default
|
|
/// </remarks>
|
|
public RestartProgramRequestHandler()
|
|
: base(true)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Handles POST method requests
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
protected override void HandlePost(HttpCwsContext context)
|
|
{
|
|
var message = "";
|
|
if(CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
|
|
CrestronConsole.SendControlSystemCommand($"progres -p:{InitialParametersClass.ApplicationNumber}", ref message);
|
|
|
|
context.Response.StatusCode = 200;
|
|
context.Response.StatusDescription = "OK";
|
|
context.Response.Write(message, false);
|
|
context.Response.End();
|
|
}
|
|
}
|
|
} |