From b5b3f2bf5b04de190acea40790537b9e96649188 Mon Sep 17 00:00:00 2001 From: lss <344300806@qq.com> Date: 星期三, 20 五月 2020 18:04:12 +0800 Subject: [PATCH] 2020.05.20.1 --- ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundListForm.cs | 103 ++++++++++++++++++++------------------------------- 1 files changed, 40 insertions(+), 63 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundListForm.cs index 8e14711..e28a120 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundListForm.cs @@ -1,5 +1,7 @@ 锘縰sing System; using System.Collections.Generic; +using System.Diagnostics; +using System.Threading.Tasks; using Shared.Common; using Shared.Phone.UserCenter.Device; using ZigBee.Device; @@ -13,7 +15,8 @@ { } - private List<SmartSound> smartSoundList = null; + //private List<SmartSoundInfo> smartSoundList = null; + private SmartSoundInfo smartSoundInfo = null; /// <summary> /// 鍒楄〃鎺т欢 @@ -24,6 +27,8 @@ /// </summary> private RowLayoutControl oldShowRightMuneRow = null; + private static string dataString = ""; + #region 鈻� 鍒濆鍖朹____________________________ @@ -32,7 +37,7 @@ /// </summary> public void ShowForm() { - iniData();//鍏堝姞杞芥ā鎷熸暟鎹� + // iniData();//鍏堝姞杞芥ā鎷熸暟鎹� this.ScrollEnabled = false; @@ -58,11 +63,7 @@ //杩欓噷鏄姞杞藉府缁勭殑鐣岄潰 }; - string room_id = Common.Config.Instance.Home.Id;//浣忓畢 ID - string gu_id = Common.Config.Instance.Guid; - - Console.WriteLine("room_id =" + room_id); - Console.WriteLine("gu_id =" + gu_id); + } @@ -70,11 +71,11 @@ /// 鍒濆鍖栦腑閮ㄦ帶浠�(澶栭儴鍙互璋冪敤) /// </summary> /// <param name="i_reGetDeviceOnlineStatu">閲嶆柊鑾峰彇璁惧鐨勫湪绾跨姸鎬�</param> - public void InitMiddleFrame() + public async void InitMiddleFrame() { // show鍑烘病鏈夎澶囩殑鍥炬爣鏂囧瓧鎻愮ず this.ShowNotDataImage(bodyFrameLayout, new string[] { "杩樻病鏈夐煶绠卞摝锛�", "缁戝畾鏅鸿兘闊崇璇峰墠寰�绗笁鏂� APP 杩涜鎿嶄綔" }); - + var frame = new FrameLayout(); this.bodyFrameLayout.AddChidren(frame); frame.BackgroundColor = UserCenterColor.Current.White; @@ -88,8 +89,9 @@ frame.AddChidren(listView); listView.BeginHeaderRefreshingAction += () => { - HdlThreadLogic.Current.RunThread(() => + HdlThreadLogic.Current.RunThread(async () => { + await getData(); //涓嬫媺鍒锋柊 iniView(); @@ -102,7 +104,23 @@ }); }; + this.ShowProgressBar(); + + await getData(); + + this.CloseProgressBar( ShowReLoadMode.YES); iniView(); + } + + 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 = ""; + + dataString = await UserCenterLogic.GetResponseDataByRequestHttps("zigbeespeakerservice/Auth", true, auth); + smartSoundInfo = (SmartSoundInfo)Newtonsoft.Json.JsonConvert.DeserializeObject(dataString); } private void iniView() @@ -110,33 +128,21 @@ // listView.RemoveAll(); - if (smartSoundList == null) + if (smartSoundInfo==null) return; - for (int i = 0; i < smartSoundList.Count; i++) + for (int i = 0; i < smartSoundInfo.ResponseData.Data.Count; i++) { // - var smartSound = smartSoundList[i]; + var smartSound = smartSoundInfo.ResponseData.Data[i]; var row = new SoundRowLayout(); listView.AddChidren(row); - switch (smartSound.Type) - { - case SmartSound.SMARTSOUND_XIAODU: - row.Account = "灏忓害锛�" + smartSound.UserName; - row.ImagePath = "SmartSound/Xiaodu.png"; - row.Remark = smartSound.Remark; - break; - case SmartSound.SMARTSOUND_XIAOAI: - row.Account = "灏忕埍锛�" + smartSound.UserName; - row.ImagePath = "SmartSound/Xiaoai.png"; - row.Remark = smartSound.Remark; - break; - case SmartSound.SMARTSOUND_TIANMAO: - row.Account = "澶╃尗绮剧伒锛�" + smartSound.UserName; - row.ImagePath = "SmartSound/Tianmao.png"; - row.Remark = smartSound.Remark; - break; + if (smartSound.Platform == "Xiaodu") + { + row.Account = "灏忓害锛�" + smartSound.UserName; + row.ImagePath = "SmartSound/Xiaodu.png"; + row.Remark = smartSound.Remark; } row.InitControl(); @@ -148,7 +154,7 @@ { // int index = (int)(((NormalViewControl)sender).GetTagByKey("index")); - var smartSound = smartSoundList[index]; + var smartSound = smartSoundInfo.ResponseData.Data[index]; ShowRenameDialog(row, smartSound); }; @@ -177,8 +183,8 @@ { this.ShowMassage(ShowMsgType.Confirm, "鎺ヨЕ缁戝畾闇�瑕佺涓夋柟 APP 杩涜鎿嶄綔", () => { - // - smartSoundList.RemoveAt(index); + // 绉婚櫎缁戝畾鐨勯�昏緫 + //smartSoundList.RemoveAt(index); listView.RemoveAt(index); },"璺宠浆鑷冲皬搴� APP"); } @@ -187,7 +193,7 @@ /// 閲嶅懡鍚嶅脊绐� /// </summary> /// <returns></returns> - private void ShowRenameDialog(SoundRowLayout soundRowLayout, SmartSound smartSound) + private void ShowRenameDialog(SoundRowLayout soundRowLayout, SmartSoundInfo.SoundInfo smartSound) { //鐢熸垚涓�涓脊绐楃敾闈� var dialogForm = new DialogInputControl(); @@ -208,35 +214,6 @@ soundRowLayout.btnRemark.Text= textValue; }); } - - /// <summary> - /// 鍒濆鍖栨ā鎷熶竴浜涙暟鎹紝鐢ㄦ潵鍔犺浇鐣岄潰鐢ㄧ殑 - /// </summary> - private void iniData() - { - smartSoundList = new List<SmartSound>(); - - // 澧炲姞灏忓害闊崇 - SmartSound smartSound = new SmartSound(); - smartSound.Remark = "鎴戠殑闊崇"; - smartSound.UserName = "123456@qq.com"; - smartSound.Type = SmartSound.SMARTSOUND_XIAODU; - smartSoundList.Add(smartSound); - - // 澧炲姞灏忕埍闊崇 - smartSound = new SmartSound(); - smartSound.Remark = "鎴戠殑闊崇"; - smartSound.UserName = "234567@qq.com"; - smartSound.Type = SmartSound.SMARTSOUND_XIAOAI; - smartSoundList.Add(smartSound); - - // 澧炲姞澶╃尗绮剧伒 - smartSound = new SmartSound(); - smartSound.Remark = "鎴戠殑闊崇"; - smartSound.UserName = "345678@qq.com"; - smartSound.Type = SmartSound.SMARTSOUND_TIANMAO; - smartSoundList.Add(smartSound); - } #endregion -- Gitblit v1.8.0