| | |
| | | public int CurrentIndex = 0; |
| | | private MostRightIconControl btnAddDeviceIcon = null; |
| | | /// <summary> |
| | | /// 当前楼层的名称 |
| | | /// </summary> |
| | | private static NormalViewControl pullLayoutText = null; |
| | | /// <summary> |
| | | /// 智能音箱数据 |
| | | /// </summary> |
| | | private static SmartSoundInfo.SoundInfo mSoundInfo = null; |
| | | /// <summary>
|
| | | /// 楼层控件
|
| | | /// </summary> |
| | | private MyPullControl myPullControl; |
| | | |
| | | public SmartSoundControlForm(SmartSoundInfo.SoundInfo soundInfo) |
| | | { |
| | |
| | | SmartSound.getInstantiate().LayerList = dataInfo.ResponseData.LayerList; |
| | | SmartSound.getInstantiate().TokenID = mSoundInfo.Id; |
| | | SmartSound.getInstantiate().UserID = mSoundInfo.UserID; |
| | | SmartSound.getInstantiate().HomeID = mSoundInfo.HomeID; |
| | | } |
| | | } |
| | | |
| | |
| | | if (SmartSound.getInstantiate().LayerList == null || SmartSound.getInstantiate().LayerList.Count < 1) |
| | | { |
| | | this.CloseProgressBar(); |
| | | this.ShowNotDataImage(this.bodyFrameLayout, new string[] { "还没有控制内容哦,", "点击\"+\"添加" }); |
| | | return; |
| | | } |
| | | |
| | |
| | | this.bodyFrameLayout.AddChidren(contentLayout); |
| | | contentLayout.RemoveAll(); |
| | | |
| | | var pullLayout = new MyPullControl(this, SmartSound.getInstantiate().LayerList); |
| | | contentLayout.AddChidren(pullLayout); |
| | | pullLayout.InitControl(); |
| | | myPullControl = new MyPullControl(this, SmartSound.getInstantiate().LayerList); |
| | | contentLayout.AddChidren(myPullControl); |
| | | myPullControl.InitControl(); |
| | | |
| | | LoadAllRoomListView(); |
| | | |
| | | //无数据的时候要做一个提示 |
| | | { |
| | | bool bol = false; |
| | | for (int i = 0; i < SmartSound.getInstantiate().LayerList.Count; i++) |
| | | { |
| | | if (SmartSound.getInstantiate().LayerList[i].RoomList.Count > 0) |
| | | { |
| | | bol = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!bol) |
| | | { |
| | | pullLayout.Visible = false; |
| | | this.ShowNotDataImage(this.bodyFrameLayout, new string[] { "还没有控制内容哦,", "点击\"+\"添加" }); |
| | | } |
| | | } |
| | | |
| | | |
| | | this.CloseProgressBar(); |
| | | |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 判断是否有数据 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private bool HaveData() |
| | | { |
| | | bool bol = false; |
| | | for (int i = 0; i < SmartSound.getInstantiate().LayerList.Count; i++) |
| | | { |
| | | if (SmartSound.getInstantiate().LayerList[i].RoomList.Count > 0) |
| | | { |
| | | bol = true; |
| | | break; |
| | | } |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(173); |
| | | } |
| | | |
| | | listView.RemoveAll(); |
| | | |
| | | SmartSound.Layer layer = SmartSound.getInstantiate().LayerList[CurrentIndex]; |
| | | pullLayoutText.Text = layer.LayerName; |
| | | listView.RemoveAll(); |
| | | |
| | | foreach (SmartSound.Room room in layer.RoomList) |
| | | { |
| | |
| | | var delBtn = sender as NormalViewControl; |
| | | DelectRoom(delBtn); |
| | | }; |
| | | } |
| | | |
| | | if (!HaveData()) |
| | | { |
| | | SmartSound.getInstantiate().LayerList.Clear(); |
| | | myPullControl.Visible = false; |
| | | this.ShowNotDataImage(this.bodyFrameLayout, new string[] { "还没有控制内容哦,", "点击\"+\"添加" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | |
| | | private async Task<string> GetData() |
| | | { |
| | | // 从服务器获取数据 |
| | | string url = string.Format("https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit?Platform&UserID={0}&TokenID={1}", mSoundInfo.UserID, mSoundInfo.Id); |
| | | {
|
| | | // 从服务器获取数据
|
| | | string url = string.Format("https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit?Platform&UserID={0}&TokenID={1}&HomeID={2}", mSoundInfo.UserID, mSoundInfo.Id,mSoundInfo.HomeID);
|
| | | return await MyHttpWebResponse.GetWebRequest(url); |
| | | } |
| | | |
| | |
| | | // 提交数据至服务器 |
| | | 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; |
| | | } |
| | | |
| | |
| | | right_icon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | ShowPullList(); |
| | | }; |
| | | |
| | | var layout = this.AddMostRightView(Layers[smartSoundControlData.CurrentIndex].LayerName, 300, false); |
| | | layout.Name = "pullLayout"; |
| | | layout.ButtonClickEvent += (sender, e) => |
| | | };
|
| | |
|
| | | pullLayoutText = this.AddMostRightView(Layers[smartSoundControlData.CurrentIndex].LayerName, 300, false); |
| | | pullLayoutText.Name = "pullLayout"; |
| | | pullLayoutText.ButtonClickEvent += (sender, e) => |
| | | { |
| | | ShowPullList(); |
| | | }; |
| | | |
| | | pullLayoutText.Text = Layers[smartSoundControlData.CurrentIndex].LayerName; |
| | | if (SmartSound.getInstantiate().LayerList.Count < 2) |
| | | { |
| | | right_icon.Visible = false; |
| | | layout.Visible = false; |
| | | pullLayoutText.Visible = false; |
| | | } |
| | | } |
| | | catch(Exception e) |
| | |
| | | |
| | | for (int i = 0; i < Layers.Count; i++) |
| | | { |
| | | int index = i; |
| | | //创建楼层 |
| | | pull_frame.AddRowMenu(Layers[i].LayerName, "Item/CreatFloor.png", "Item/CreatFloorSelected.png", () => |
| | | { |
| | | smartSoundControlData.CurrentIndex = i; |
| | | smartSoundControlData.CurrentIndex = index; |
| | | smartSoundControlData.LoadAllRoomListView(); |
| | | }); |
| | | } |