ZennoLab Assemblies Documentation
RemoveTask Method (ZennoPoster)
Example 

Type: System.Guid

Id of task to remove.

Remove the task
Syntax
public static void RemoveTask( 
   Guid id
)

Parameters

id

Type: System.Guid

Id of task to remove.

Example
The following example shows call the RemoveTask 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 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, remove the task
        ZennoPoster.RemoveTask(id);
    else
        throw new FormatException(string.Format("{0} is not guid", result));
}
// 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, remove the task
        ZennoPoster::RemoveTask($id);
    else
        throw new FormatException(String::Format("{0} is not guid", $result));
}
Requirements

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

See Also

Reference

ZennoPoster Class
ZennoPoster Members
AddTask Method

Send Feedback