I wrote a simple class that works with UIElement and an action to call. Whenever an action is invoked, it places the action on the dispatcher queue if it does not already exist. I use it to reduce the 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 suggest a name for this class and method? Thanks
As a name for the class, I will define "DispatcherAction" and a method that I would call "Queue".
, "" "" , , . , .
Update: , , , "TryQueue" . "true", , "false", , .
DispatchManager Start()?
Source: https://habr.com/ru/post/1756865/More articles:Adding UIFont and finding fontfamily file with EXC_BAD_ACCESS - iosMigrating from SVN to TFS - version-controlWill replacing a monger with a thin one or a passenger improve scalability - ruby-on-railsTechnology for infinitely long pipes - unixBest practice for binding user control data - how to do it? - .netGetting response body using Zend_http_Client - restIE7 hack float / block error - htmlHow is it possible for the complexity of the Boruvka algorithm to be O (E * logV)? - language-agnosticMemory usage for using display: table jstl tag - javaMissing page on a Magento catalog page - magentoAll Articles