public bool GetGUIMessage(out IProcessingState state, int timeout = 0)
{
int counter = 0;
while (counter <= timeout)
{
if (_toProcessingQueue.Count != 0)
{
state = _toProcessingQueue.Dequeue();
return false;
}
else
{
counter += 5;
Thread.Sleep(5);
}
}
state = null;
return true;
}