1. public void ThreadTask()
    2. {
    3. Panda.Framework.Helper.ConsoleHelper.WriteInfoLine("==》自动化任务启动");
    4. deviceTimerThread = new Thread(DeviceTimerThread);
    5. deviceTimerThread.Start();
    6. }
    1. private async void DeviceTimerThread()
    2. {
    3. #region 阀门定时任务线程
    4. if (GloalConfigs.EnableRuningTimerDevice)
    5. {
    6. return;
    7. }
    8. GloalConfigs.EnableRuningTimerDevice = true;
    9. while (GloalConfigs.EnableRuningTimerDevice)
    10. {
    11. #region 任务线程
    12. try
    13. {
    14. }
    15. catch
    16. {
    17. //错误处理
    18. }
    19. finally
    20. {
    21. await Task.Delay(1000);
    22. }
    23. #endregion
    24. }
    25. #endregion
    26. }