// Gets list of tasks
var tasksList = new List<string>(ZennoPoster.TasksList);
// Check the presence of items in the list
if(tasksList.Count != 0)
{
// Select ane item
var source = tasksList[0];
// Sets path to task id
var xpath = "Task/Id";
// Gets guid string from task data
var doc = new System.Xml.XmlDocument();
doc.LoadXml("<Task>" + source + "</Task>");
string result;
var node = doc.SelectSingleNode(xpath);
if (node != null)
result = node.InnerXml;
else
throw new InvalidDataException(string.Format("{0} is null", xpath));
Guid id;
// Parse guid
if (Guid.TryParse(result, out id))
// If ok, stop the task
ZennoPoster.StopTask(id);
else
throw new FormatException(string.Format("{0} is not guid", result));
}