黄学彪
2020-06-18 2450c12c825ad4d78d1572da2fa421706db2df2f
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);