|
using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrainTechLLC;
using BrainTechLLC.EmlenMud;
using BrainTechLLC.EmlenMud.Objects;
using BrainTechLLC.EmlenMud.Interfaces;
using BrainTechLLC.ThreadSafeObjects;
namespace Article1
{
public class DemoWorkItem : IExecutableWorkItem
{
private static long _workItemsExecuted;
public DemoWorkItem(DateTime executionTime) { ExecutionTime = executionTime; }
public DateTime ExecutionTime { get; set; }
public bool Cancelled { get; set; }
public void Execute()
{
long n = Interlocked.Increment(ref _workItemsExecuted);
long nMod5 = n % 5;
switch (nMod5)
{
case 0:
WorkItemResult = (n + 1000) / 3;
break;
case 1:
WorkItemResult = new TestThing(Convert.ToInt32(n / 500000), nMod5.ToString());
break;
case 2:
WorkItemResult = 12;
break;
case 3:
WorkItemResult = "This is a test";
break;
case 4:
WorkItemResult = "ABC";
break;
}
}
public object WorkItemResult { get; set; }
}
public class TestThing
{
public TestThing(int testValue, string testStringValue)
{
TestValue = testValue;
TestStringValue = testStringValue;
}
public int TestValue {get;set;}
public string TestStringValue {get;set;}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Currently working as a Senior Silverlight Developer with Troppus Software in Superior, CO. I enjoy statistics, programming, new technology, playing the cello, and reading codeproject articles.