I have written a simple class that works with a UIElement and an action to invoke. Whenever the action is invoked, it puts the action in dispatcher queue, if its not already there. I use it to reduce number of calls.
class NoNameClass
{
// has element and action in its ctor.
void NoNameMethod()
{
if (!inQueue)
{
inQueue = true;
element.Dispatcher.BeginInvoke(()=>
{
inQueue = false;
action();
}
}
}
bool inQueue;
}
Can you please suggest a name for this class and the method? Thanks