A Rapid Development Framework for Community Server

Tasks - Create Task Structure.cst

Tasks - Create Task Structure.cst
posted by daveburke
11-02-2008


Downloads: 141
File size: 36.8kB
Views: 1,508

This template creates the structure of a Community Server Task class, with instructions on what to add in the CommunityServer_Override.config file.

Property Descriptions


MethodName: Name of the method that performs the task.  Default: WriteDriveData.  Example: public void [WriteDriveData](int settingsID);

NameSpace: Namespace root of your custom project.  Default: DRIVE

TaskName: Name of Task/Class.  Default: DriveTask.  Example: public class [DriveTask] : ITask

 

Sample Generated Code

 


using System;
using System.Collections.Generic;
using System.Xml;
using CommunityServer.Components;
using Telligent.Tasks;

namespace DRIVE.Components
{

    public class DriveTask : ITask
    {

        public void Execute(XmlNode node)
        {
            SiteSettingsManager.IterateSiteSettings(new SiteSettingsListIterator(WriteDriveData));
        }

        public void WriteDriveData(int settingsID)
        {

            //CSContext ctx = CSContext.Create(1000);
            //DrivePosts.EnterTaskDateTime();

        }
    }
}

// Add the following to your CommunityServer_Overrides.config

    <Override xpath = "/CommunityServer/Tasks/Threads" mode = "add" >
        <Thread minutes="5">
            <task name = "DriveTask" type = "DRIVE.Components.DriveTask, DRIVE" enabled = "true" enableShutDown = "false" />
        </Thread>
    </Override>
   
Please sign-in to post a comment or question about this template or topic