ZennoLab Assemblies Documentation
StopTask(String) Method
Example 

Type: System.String

Name of task to stop. Finds the first occurrence.

Stop the task by name.
Syntax
public static void StopTask( 
   string name
)

Parameters

name

Type: System.String

Name of task to stop. Finds the first occurrence.

Example
The following example shows call the StopTask method.
// 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 name
    var xpath = "Task/Name";
 
    // Gets guid string from task data
    var doc = new System.Xml.XmlDocument();
    doc.LoadXml("<Task>" + source + "</Task>");
    string name;
    var node = doc.SelectSingleNode(xpath);
    if (node != null)
        name = node.InnerXml;
    else 
        throw new InvalidDataException(string.Format("{0} is null", xpath));
 
    if(!String.IsNullOrEmpty(name))
        // If ok, stop first task with this name
        ZennoPoster.StopTask(name);
    else
        throw new FormatException("Name is empty");
}
// 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 name
    $xpath = "Task/Name";
 
    // Gets guid string from task data
    $doc = new System\Xml\XmlDocument();
    $doc->LoadXml("<Task>" + $source + "</Task>");
    $name;
    $node = $doc->SelectSingleNode($xpath);
    if ($node != null)
        $name = $node->InnerXml;
    else 
        throw new InvalidDataException(String::Format("{0} is null", $xpath));
 
    if (String::IsNullOrEmpty($name))
        // If ok, stop first task with this name
        ZennoPoster::StopTask($name);
    else
        throw new FormatException("Name is empty");
}
Requirements

Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.

See Also

Reference

ZennoPoster Class
ZennoPoster Members
Overload List

Send Feedback