private void Run() { while (AutoRun) { try { if (Queue.IsEmpty) { Thread.Sleep(1000); continue; } ITaskElement item; if (Queue.TryDequeue(out item)) { if (item.Try()) { if (item.TryCount > 0 && item.TrySleep > 0) { Thread.Sleep(item.TrySleep); } var o = Actuator.Run(item); if (!o.Key) { Queue.Enqueue(o.Value); } } } } catch (Exception e) { SetError(e.ToString()); } } }