| | |
| | | }); |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 2020-06-05 加锁 |
| | | /// </summary> |
| | | private readonly object SendLocker = new object (); |
| | | |
| | | public void ControlScene (string sceneFilePath) |
| | | { |
| | |
| | | foreach (var deviceFilePath in tempScene.DeviceFilePathList) { |
| | | controlDeviceIndex++; |
| | | new System.Threading.Thread (() => { |
| | | try { |
| | | lock (SendLocker) { |
| | | mSendCount++; |
| | | } |
| | | //mSendCount++; |
| | | var common = Newtonsoft.Json.JsonConvert.DeserializeObject<Common> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath))); |
| | | if (common.Type == DeviceType.LightDimming) { |
| | | var device = Newtonsoft.Json.JsonConvert.DeserializeObject<LightDimming> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath))); |
| | |
| | | } catch { |
| | | } |
| | | |
| | | //mSendCount--; |
| | | } catch { } finally { |
| | | lock (SendLocker) { |
| | | mSendCount--; |
| | | } |
| | | } |
| | | }){ IsBackground = true}.Start(); |
| | | |
| | | //等待100ms再发送第二个设备数据 |