From 2450c12c825ad4d78d1572da2fa421706db2df2f Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 18 六月 2020 16:01:14 +0800 Subject: [PATCH] 新代码 --- ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs | 69 +++++++++++++++++++++++----------- 1 files changed, 46 insertions(+), 23 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs b/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs index 02c58fe..121602e 100755 --- a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs +++ b/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs @@ -75,6 +75,7 @@ SmartSound.getInstantiate().LayerList = CollateData(); SmartSound.getInstantiate().TokenID = mSoundInfo.Id; SmartSound.getInstantiate().UserID = mSoundInfo.UserID; + SmartSound.getInstantiate().HomeID = mSoundInfo.HomeID; //涓婁紶鏁版嵁鍒版湇鍔″櫒 string str = await postBatchEdit(); @@ -133,7 +134,7 @@ // The remote server returned an error: (400) Bad Request. string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); - string response_str = await MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); + string response_str = MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); return response_str; } @@ -181,7 +182,6 @@ for (int n = 0; n < SmartSound.LocaData.Count; n++) { SmartSound.Layer layer = SmartSound.LocaData[n]; - foreach (Room room in roomList) { try @@ -207,20 +207,27 @@ continue; SmartSound.Device smartDevice = new SmartSound.Device(); - //smartDevice.Id = device.DeviceID.ToString();//璁惧 Id smartDevice.DeviceAddress = device.DeviceAddr;//璁惧 MAC smartDevice.Epoint = device.DeviceEpoint;//璁惧绔彛 - //smartDevice.ClusterID = 0; - smartDevice.DeviceName = device.DeviceName;//璁惧鍚嶇О + smartDevice.DeviceName = Common.LocalDevice.Current.GetDeviceEpointName(device);//璁惧鍚嶇О smartDevice.NicksName = ""; smartDevice.DeviceType = GetDeviceType(device);//璁惧绫诲瀷 - smartDevice.GatewayID = device.CurrentGateWayId;//缃戝叧 Id - //smartDevice.RoomID = room.Id;//鎴块棿 Id + if (smartDevice.DeviceType == 0) + continue; + + if(ZbGateway.GateWayBaseInfomations.ContainsKey(device.CurrentGateWayId) ==true) + { + smartDevice.GatewayID = ZbGateway.GateWayBaseInfomations[device.CurrentGateWayId].MacMark;//缃戝叧 Id + } + else + { + smartDevice.GatewayID = device.CurrentGateWayId;//缃戝叧 Id + } + if (smartDevice.DeviceName == "" || smartDevice.DeviceName == string.Empty) continue; smartRoom.DeviceList.Add(smartDevice); - } #endregion @@ -229,25 +236,36 @@ #region //娣诲姞鍦烘櫙 for (int k = 0; k < sceneList.Count; k++) { - SceneUI scene = sceneList[k]; - - if (scene == null) continue; - SmartSound.Scene smartScene = new SmartSound.Scene(); - //smartScene.Id = scene.DeviceID.ToString(); - smartScene.SceneName = scene.Name; - smartScene.SceneID = scene.Id; - smartScene.DelayTime = scene.DelayTime; - //smartScene.ClusterID = 0; - smartScene.NicksName = ""; - //smartScene.RoomID = room.Id; - smartScene.GatewayID = ZbGateway.MainGateWay.GwId; + try + { + SceneUI scene = sceneList[k]; - if (smartScene.SceneName == "" || smartScene.SceneName == string.Empty) - continue; + if (scene == null) continue; + SmartSound.Scene smartScene = new SmartSound.Scene(); + smartScene.SceneName = scene.Name; + smartScene.SceneID = scene.Id; + smartScene.DelayTime = scene.DelayTime; + smartScene.NicksName = ""; + if (ZbGateway.GateWayBaseInfomations.ContainsKey(ZbGateway.MainGateWay.GwId) == true) + { + smartScene.GatewayID = ZbGateway.GateWayBaseInfomations[ZbGateway.MainGateWay.GwId].MacMark;//缃戝叧 Id + } + else + { + smartScene.GatewayID = ZbGateway.MainGateWay.GwId;//缃戝叧 Id + } - smartRoom.SceneList.Add(smartScene); + if (smartScene.SceneName == "" || smartScene.SceneName == string.Empty) + continue; + + smartRoom.SceneList.Add(smartScene); + } + catch (Exception e) { } } #endregion + + if (smartRoom.DeviceList.Count == 0 && sceneList.Count == 0) + layer.RoomList.Remove(smartRoom); } catch (Exception e) @@ -432,6 +450,7 @@ if (!_device.Checked) { _room.DeviceList.Remove(_device); + k--; } } #endregion @@ -443,6 +462,7 @@ if (!_scene.Checked) { _room.SceneList.Remove(_scene); + n--; } } #endregion @@ -450,6 +470,7 @@ else { _layer.RoomList.Remove(_room); + j--; } } } @@ -461,6 +482,7 @@ if (_layer.RoomList.Count < 1) { TempDatas.Remove(_layer); + j--; } } } @@ -591,6 +613,7 @@ btnName.TextSize = 17; btnName.Y = Application.GetRealHeight(57); btnName.Text = mRoom.RoomName; + Right_icon = this.AddRightArrow(); Right_icon.Width = Application.GetRealWidth(115); Right_icon.Height = Application.GetRealHeight(115); -- Gitblit v1.8.0