private void UpdateNodesLoop()
{
Task.Run(() =>
{
while (true)
{
System.Threading.Thread.Sleep(10);
if ((DateTime.Now - lastUpdateTime).TotalMilliseconds < updateInterval)
continue;
lastUpdateTime = DateTime.Now;
lock (nodesLock)
{
if (nodes == null || !nodes.Any())
continue;
try
{
foreach (var node in nodes)
{
node.Loop();
if (!started)
break;
}
if (started)
OnUpdateLoop?.Invoke();
}
catch
{
}
}
}
});
}