| | |
| | | |
| | | //public static Button LogoButton = new Button (); |
| | | |
| | | public static string CodeIDString = "20230202"; |
| | | public static string CodeIDString = "20230726"; |
| | | /// <summary> |
| | | /// 网关状态 |
| | | /// </summary> |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public static System.Threading.Thread staticReadDeviceStatusThread; |
| | | public static bool readDevciesStatus = false; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 显示当前界面 |
| | | /// </summary> |
| | |
| | | Loading.TextColor = 0xFFA9A9A9; |
| | | Loading.LodingBackgroundColor = SkinStyle.Current.MainColor; |
| | | } |
| | | |
| | | staticReadDeviceStatusThread = new System.Threading.Thread (() => { |
| | | while (true) { |
| | | System.Threading.Thread.Sleep (1000); |
| | | if (readDevciesStatus) { |
| | | try { |
| | | var readList = new List<string> (); |
| | | foreach (Room room in Room.Lists) { |
| | | if (string.IsNullOrEmpty (room.Name)) { |
| | | continue; |
| | | } |
| | | var list = room.DeviceList.FindAll ((obj) => { |
| | | return (obj.Type == DeviceType.LightDimming || obj.Type == DeviceType.LightSwitch || obj.Type == DeviceType.LightLogic |
| | | || obj.Type == DeviceType.LightSwitchSocket || obj.Type == DeviceType.LightEnergySwitch || obj.Type == DeviceType.LightEnergySocket |
| | | || obj.Type == DeviceType.LightMixDimming || obj.Type == DeviceType.LightMixSwitch || obj.Type == DeviceType.FanModule); |
| | | }); |
| | | foreach (Common common in list) { |
| | | var s = common.Type + "_" + common.SubnetID + "_" + common.DeviceID; |
| | | //已经读取过当前设备就不再读取 |
| | | if (readList.Contains (s)) { |
| | | continue; |
| | | } |
| | | readList.Add (s); |
| | | Control.ControlBytesSend (Command.ReadLightEquipmentAllLoopBrightness, common.SubnetID, common.DeviceID, new byte [] { }, SendCount.Zero); |
| | | System.Threading.Thread.Sleep (1000); |
| | | } |
| | | } |
| | | readList.Clear (); |
| | | } catch { } finally { |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | staticReadDeviceStatusThread.IsBackground = true; |
| | | staticReadDeviceStatusThread.Start (); |
| | | |
| | | |
| | | } catch (Exception ex) { |
| | | //new Alert ("Eorr", ex.Message, "Close").Show(); |
| | | } |