private void HandleGetRequest()
{
Debug.WriteLine("request: {0}", this.HttpUrl);
var httpUrl = Uri.UnescapeDataString(this.HttpUrl);
try
{
var str = string.Empty;
var split = httpUrl.Split('&');
if (split.Any())
{
split[0] = split[0].Remove(0, 2);
var dict = new Dictionary<string, string>();
foreach (var item in split)
{
var splittedItem = item.Replace('+', ' ').Split('=');
if (!splittedItem.Any())
{
continue;
}
dict.Add(splittedItem[0], splittedItem.Length > 1 ? splittedItem[1] : string.Empty);
}
string action;
if (dict.TryGetValue("action", out action))
{
switch (action.ToUpper())
{
case "WASTL_DISPLAY_ACTIVATE":
Bootstrapper.GetInstance<IWindowManager>().ActivateWastlDisplay();
Bootstrapper.GetInstance<IPrintController>().Print(true);
break;
case "WASTL_LOG":
Log("Log: " + httpUrl, EventLogEntryType.Information);
break;
case "WASTL_PRINTSERVICE_PRINT":
Bootstrapper.GetInstance<IPrintController>().Print();
break;
}
}
}
this.WriteSuccess();
this.OutputStream.WriteLine("{status:\"OK\",message:\"" + str + "\"}");
}
catch (Exception exception)
{
Logger.Warn(exception);
this.WriteFailure();
this.OutputStream.WriteLine("{status:\"Error\",message:\"" + exception.Message + "\"}");
}
}