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
{
///
/// Constructor
///
///
/// base(true) enables CORS support by default
///
public RestartProgramRequestHandler()
: base(true)
{
}
///
/// Handles POST method requests
///
///
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();
}
}
}