| | |
| | | using Shared.Common; |
| | | using Shared.Phone.UserCenter.Device; |
| | | using Shared.Phone.UserCenter.SmartSound.Util; |
| | | using Shared.Phone.UserCenter.SmartSound.Widget; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserCenter.SmartSound |
| | |
| | | /// </summary> |
| | | public void ShowForm() |
| | | { |
| | | // iniData();//先加载模拟数据 |
| | | |
| | | this.ScrollEnabled = false; |
| | | |
| | |
| | | Dictionary<string, string> floorDictionary = Config.Instance.Home.FloorDics;//楼层列表 |
| | | |
| | | var helpBtn = new MyButton(); |
| | | //helpBtn.TextSize = 15; |
| | | helpBtn.TextColor = UserCenterColor.Current.TextOrangeColor; |
| | | helpBtn.Text = "帮助"; |
| | | helpBtn.Gravity = Gravity.CenterRight; |
| | | helpBtn.TextAlignment = TextAlignment.CenterRight; |
| | | //helpBtn.BackgroundColor = UserCenterColor.Current.BlackBackGround; |
| | | topFrameLayout.AddChidren(helpBtn); |
| | | helpBtn.X -= Application.GetRealWidth(58); |
| | | |
| | |
| | | |
| | | helpBtn.MouseUpEventHandler += (sernder, e) => |
| | | { |
| | | //这里是加载帮组的界面 |
| | | //生成一个弹窗画面 |
| | | var dialogForm = new TextDialog("绑定智能音箱到第三方 APP 进行操作", "跳转至小度"); |
| | | dialogForm.SetTitleText("帮助"); |
| | | |
| | | //按下确认按钮 |
| | | dialogForm.ComfirmClickEvent += () => |
| | | { |
| | | //画面关闭 |
| | | dialogForm.CloseDialog(); |
| | | }; |
| | | }; |
| | | } |
| | | |
| | |
| | | /// 初始化中部控件(外部可以调用) |
| | | /// </summary> |
| | | /// <param name="i_reGetDeviceOnlineStatu">重新获取设备的在线状态</param> |
| | | public async void InitMiddleFrame() |
| | | public void InitMiddleFrame() |
| | | { |
| | | // show出没有设备的图标文字提示 |
| | | this.ShowNotDataImage(bodyFrameLayout, new string[] { "还没有音箱哦,", "绑定智能音箱请前往第三方 APP 进行操作" }); |
| | | |
| | | this.ClearBodyFrame(); |
| | | |
| | | var frame = new FrameLayout(); |
| | | this.bodyFrameLayout.AddChidren(frame); |
| | | frame.BackgroundColor = UserCenterColor.Current.White; |
| | |
| | | frame.AddChidren(listView); |
| | | listView.BeginHeaderRefreshingAction += () => |
| | | { |
| | | HdlThreadLogic.Current.RunThread(async () => |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | await getData(); |
| | | //下拉刷新 |
| | | iniView(); |
| | | |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //隐藏下拉刷新特效 |
| | | listView.EndHeaderRefreshing(); |
| | | this.InitMiddleFrame(); |
| | | }); |
| | | |
| | | }); |
| | | }; |
| | | |
| | | this.ShowProgressBar(); |
| | | HdlThreadLogic.Current.RunThread(async () => |
| | | { |
| | | this.ShowProgressBar(); |
| | | await getData(); |
| | | |
| | | await getData(); |
| | | HdlThreadLogic.Current.RunMainInThread(() => |
| | | { |
| | | iniView(); |
| | | |
| | | this.CloseProgressBar(ShowReLoadMode.NO); |
| | | if (smartSoundInfo == null || smartSoundInfo.ResponseData == null || smartSoundInfo.ResponseData.RowCount == 0) |
| | | { |
| | | // show出没有设备的图标文字提示 |
| | | this.ShowNotDataImage(bodyFrameLayout, new string[] { "还没有音箱哦,", "绑定智能音箱请前往第三方 APP 进行操作" }); |
| | | } |
| | | |
| | | iniView(); |
| | | this.CloseProgressBar(); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取音箱列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private async Task getData() |
| | | { |
| | | SmartSoundInfo.Auth auth = new SmartSoundInfo.Auth(); |
| | | auth.HomeID = Common.Config.Instance.Home.Id; |
| | | auth.UserID = Common.Config.Instance.Guid; |
| | | auth.Platform = ""; |
| | | //SmartSoundInfo.Auth auth = new SmartSoundInfo.Auth(); |
| | | //auth.HomeID = Common.Config.Instance.Home.Id; |
| | | //auth.UserID = Common.Config.Instance.Guid; |
| | | //auth.Platform = ""; |
| | | string url = string.Format("https://developer.hdlcontrol.com/zigbeespeakerservice/Auth?Platform&PageSetting.PageSize=100&PageSetting.PageIndex=1&UserID={0}&HomeID={1}", |
| | | Common.Config.Instance.Guid,Common.Config.Instance.Home.Id); |
| | | byte[] byteData = Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(auth)); |
| | | //byte[] ResponseData = null; |
| | | |
| | | dataString = await UserCenterLogic.GetResponseDataByRequestHttps("zigbeespeakerservice/Auth", true, auth); |
| | | //Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(pra) |
| | | //dataString = System.Text.Encoding.UTF8.GetString(ResponseData); |
| | | |
| | | dataString = await MyHttpWebResponse.GetWebRequest(url); |
| | | |
| | | smartSoundInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<SmartSoundInfo>(dataString); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// 设置备注 |
| | | /// </summary> |
| | | /// <param name="soundInfo"></param> |
| | | /// <param name="new_remark"></param> |
| | |
| | | row.InitControl(); |
| | | row.btnDelect.AddTag("index", i); |
| | | row.btnRename.AddTag("index", i); |
| | | row.frameTable.AddTag("index", i); |
| | | |
| | | //重命名 |
| | | row.btnRename.ButtonClickEvent += (sender, e) => |
| | | { |
| | | // |
| | | int index = (int)(((NormalViewControl)sender).GetTagByKey("index")); |
| | | int index = (int)((NormalViewControl)sender).GetTagByKey("index"); |
| | | var smartSound = smartSoundInfo.ResponseData.Data[index]; |
| | | ShowRenameDialog(row, smartSound); |
| | | |
| | | }; |
| | | |
| | | // 解除绑定 |
| | | row.btnDelect.ButtonClickEvent += (sender, e) => |
| | | { |
| | | // |
| | | int index = (int)(((NormalViewControl)sender).GetTagByKey("index")); |
| | | ShowDelectDialog(index); |
| | | }; |
| | | |
| | | //跳转到控制内容界面 |
| | | //跳转到控制内容界面 FrameRowControl |
| | | row.frameTable.ButtonClickEvent += (sender, e) => |
| | | { |
| | | if (SmartSound.CurretnData != null) |
| | | SmartSound.CurretnData.Clear(); |
| | | var smartSoundControlForm = new SmartSoundControlForm(); |
| | | int index = (int)row.frameTable.GetTagByKey("index"); |
| | | if (SmartSound.getInstantiate().LayerList != null) |
| | | SmartSound.getInstantiate().LayerList.Clear(); |
| | | |
| | | var smartSoundControlForm = new SmartSoundControlForm(smartSoundInfo.ResponseData.Data[index]); |
| | | smartSoundControlForm.AddForm(); |
| | | }; |
| | | } |
| | |
| | | /// </summary> |
| | | private void ShowDelectDialog(int index) |
| | | { |
| | | this.ShowMassage(ShowMsgType.Confirm, "接触绑定需要第三方 APP 进行操作", () => |
| | | //生成一个弹窗画面 |
| | | var dialogForm = new TextDialog("解除绑定需要到第三方 APP 进行操作", "跳转至小度"); |
| | | dialogForm.SetTitleText("解除绑定"); |
| | | |
| | | //按下确认按钮 |
| | | dialogForm.ComfirmClickEvent += () => |
| | | { |
| | | // 移除绑定的逻辑 |
| | | //smartSoundList.RemoveAt(index); |
| | | listView.RemoveAt(index); |
| | | }, "跳转至小度 APP"); |
| | | //画面关闭 |
| | | dialogForm.CloseDialog(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 重命名弹窗 |