Stop the task
Syntax
| C# | |
|---|
public static void StopTask(
Guid id
) |
Parameters
- id
Type: System.Guid
Id of task to stop.
Example
The following example shows call the
StopTask method.
| C# | Copy Code |
|---|
// 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));
} |
| PHP | Copy Code |
|---|
// Gets list of tasks
$tasksList = new List<string>(ZennoPoster::TasksList);
// Check the presence of items in the list
if(tasksList->Count != 0)
{
// Select ane item
$source = $tasksList[0];
// Sets path to task id
$xpath = "Task/Id";
// Gets guid string from task data
$doc = new System\Xml\XmlDocument();
$doc->LoadXml("<Task>" + $source + "</Task>");
$result;
$node = $doc->SelectSingleNode($xpath);
if ($node != null)
$result = $node->InnerXml;
else
throw new InvalidDataException(String::Format("{0} is null", $xpath));
$id = "";
// Parse guid
if (Guid::TryParse($result, $id))
// If ok, stop the task
ZennoPoster::StopTask($id);
else
throw new FormatException(String::Format("{0} is not guid", $result));
} |
Requirements
Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also