public void RemoveThread(Logger logger) { if (ReadDataThreads.ContainsKey(logger.LoggerID)) { StopThread(logger.LoggerID); ReadDataThreads.Remove(logger.LoggerID); ReadDataWorks.Remove(logger.LoggerID); } }
public void AddThread(Logger logger) { if (!ReadDataThreads.ContainsKey(logger.LoggerID)) { var work = new AutomaticReadData(); work.CurrentLogger = logger; Thread thread = new Thread(work.Run); ReadDataThreads.Add(logger.LoggerID, thread); ReadDataWorks.Add(logger.LoggerID, work); } if (logger.FirstLogDatetime != null && !ReadDataThreads[logger.LoggerID].IsAlive) { ReadDataThreads[logger.LoggerID].Start(); } }