|
// Copyright (c) 2000, 2002 - 2012 Bharath K A
//
// CREATED: Sunday March 29 11:08:13 CST 2009 by Bharath K A
//
// LAST CHANGED:
//
// AUTHOR: Bharath K A
//
// Copyright 2005 by Bharath K A
// All rights reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace BK.Util
{
enum ClientStatus
{
Updated,
NotUpdated
};
internal class ResponseDetails
{
private GridControlCometAjax gridCtrlCometAjaxInstance;
private string xmlFeed;
private bool updateRequired;
private Queue<GridAsynchResult> queueOfClientsAndStatus;
private object lockObj;
internal ResponseDetails(GridControlCometAjax GridInstance)
{
gridCtrlCometAjaxInstance = GridInstance;
queueOfClientsAndStatus = new Queue<GridAsynchResult>();
lockObj = new object();
}
internal GridControlCometAjax GridCtrlAjaxInstance
{
get
{
return gridCtrlCometAjaxInstance;
}
}
internal string XmlFeed
{
set
{
lock (lockObj)
{
xmlFeed = value;
}
}
get
{
lock (lockObj)
{
return xmlFeed;
}
}
}
internal bool UpdateRequired
{
set
{
lock (lockObj)
{
updateRequired = value;
MarkUpdateRequired();
}
}
get
{
lock (lockObj)
{
return updateRequired;
}
}
}
internal void MarkUpdateRequired()
{
lock (lockObj)
{
if (updateRequired == true)
{
Queue<GridAsynchResult>.Enumerator enumQueue = queueOfClientsAndStatus.GetEnumerator();
while (enumQueue.MoveNext())
{
enumQueue.Current.Status = ClientStatus.NotUpdated;
}
}
}
}
internal GridAsynchResult RemoveClient()
{
GridAsynchResult retVal = null;
lock (lockObj)
{
if (queueOfClientsAndStatus.Count != 0)
{
retVal = queueOfClientsAndStatus.Dequeue();
}
}
return retVal;
}
internal void AddClient(GridAsynchResult asyncResult)
{
lock (lockObj)
{
queueOfClientsAndStatus.Enqueue(asyncResult);
}
}
}
}
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.