public static string StartTask(string guid, string taskName) { try { // Create a new contract with a GUID identifier, add a handle to the task that will be executed. using (var c = new ContractSchedule(guid, taskName)) { // Adds an ACTION with delegate to the method that will perform the task c.ActionTask = delegate { // Delegated method receiving parameter with processing status Loading(c.Status); }; // Add task in processing queue QueueJob.AddTask(new ScheduledTask(c, c.ActionTask)); } return("true"); } catch (Exception e) { Console.WriteLine(e); return(JsonConvert.SerializeObject("false")); } }