c# - Name a class that puts action in dispatcher queue if its not already there -


I have written a simple class that works with a UIElement and works to invoke. Whenever action is taken, this dispatcher takes action in the queue, if it is not already, I use it to reduce the number of calls.

class NoNameClass {// has its element and verb in its ctor: zero noamath () {if (! InQueue) {inQueue = true; Element.Dispatcher.BeginInvoke (() => {inQueue = false; ACTION}}}}} bool inQueue;}

Would you please enter a name and method for this class I can define "Dispatcher Action" as the name of the class and the method Which I will call "queue".

It is possible that you can add the adjective "deferred" or "delay" names, because this execution is carried out till the dispatcher, so it is clear. That Action should not be executed immediately.

Update: For those cases whose work is abandoned, when they are already in queue, I try the method "TryQueue "I will keep the name of" and return a boolean. "If the work is queued, then if the work is expelled then the method gives" truth "because it is already queued.

< / Html>

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -