From a469a96ee8c38f7d98366dcd633e3a15f92fec65 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 01 三月 2021 17:53:52 +0800 Subject: [PATCH] 2021-3-1-1 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs | 89 ++++++++++++++++++++++++++++++++++++-------- 1 files changed, 72 insertions(+), 17 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs index 06e00f9..d2c643c 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs @@ -17,17 +17,9 @@ /// </summary> /// <param name="list">琛ㄧず璇ュ垪琛ㄥ厓绱燗-Z瀛楁瘝绛涢�夋樉绀哄嚭鏉�</param> /// <param name="list6">琛ㄧず璇ュ垪琛ㄥ厓绱犳樉绀哄湪list鍓嶉潰(璇ュ垪琛ㄥ厓绱犱笉鍋欰-Z瀛楁瘝绛涢��),娌℃湁鍙互涓簂ist6=null</param> - public void Show(List<string> list, List<string> list6) + public void Show(List<Brand>brandList,List<string> list, List<string> list6) { - //string text = "30"; - //byte[] bytes = new byte[text.Length / 2]; - //for (int i = 0, j = 0; i < bytes.Length; j += 2, i++) - //{ - // //鎶�16杩涘害杞崲鎴恇yte - // bytes[i] = Convert.ToByte(text.Substring(j, 2), 16); - //} - ////鎶奲yte鏁扮粍杞崲鎴愭枃瀛� - //string str = System.Text.Encoding.UTF8.GetString(bytes); + var frameLayout = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTop, @@ -119,7 +111,7 @@ listStr.Add(s); } } - RefreshLayout(vv, listStr); + RefreshLayout(vv, brandList, listStr); }; #region A-Z @@ -176,7 +168,7 @@ } #endregion - RefreshLayout(vv, list1); + RefreshLayout(vv, brandList, list1); } /// <summary> @@ -184,7 +176,7 @@ /// </summary> /// <param name="vv">鐖舵帶浠�</param> /// <param name="list">鏄剧ず鍒楄〃</param> - private void RefreshLayout(VerticalScrolViewLayout vv, List<string> list) + private void RefreshLayout(VerticalScrolViewLayout vv, List<Brand> brandList, List<string> list) { vv.RemoveAll(); foreach (var str in list) @@ -224,14 +216,60 @@ vv.AddChidren(rowLayout); clickBtn.MouseUpEventHandler += (sen, e) => { - ////鎵惧埌绱㈠紩鍊� - //var index = list.IndexOf(clickBtn.Tag.ToString()); - - //this.RemoveFromParent(); + var name = clickBtn.Tag.ToString(); + var brandObj = brandList.Find((c) => c.brandName == name); + if (brandObj==null) { + return; + } + GetLibraryList(brandObj.id, (libraryList) => + { + Matching matching = new Matching(); + MainPage.BasePageView.AddChidren(matching); + matching.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); + }; } + } + + /// <summary> + /// 璇诲彇鍝佺墝绾㈠鐮佸簱鍒楄〃 + /// </summary> + private void GetLibraryList(string id, Action<List<Library>> actionBrand) + { + List<Library> libraryList = new List<Library>(); + PirSend.GetDeviceTypesList(this, (responsePackNew) => + { + + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + //娓呯┖涔嬪墠鏁版嵁 + libraryList.Clear(); + var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var library = Newtonsoft.Json.JsonConvert.DeserializeObject<Library>(str); + if (library != null) + { + if (null == libraryList.Find((c) => c.brandId == library.brandId)) + { + libraryList.Add(library); + } + } + } + actionBrand(libraryList); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + }, id, "鍝佺墝绾㈠鐮佸簱鍒楄〃"); } /// <summary> /// 鍒楄〃鏄惁鍖呭惈璇ュ��(true=鍖呭惈锛宖alse=涓嶅寘鍚�) @@ -431,5 +469,22 @@ else return ("ZZ"); } } + + public class Library + { + /// <summary> + /// 绾㈠鐮� + /// </summary> + public string irCode = string.Empty; + /// <summary> + /// 鍝佺墝涓婚敭Id + /// </summary> + public string brandId = string.Empty; + /// <summary> + /// 绾㈠鐮佺储寮曞簭鍙� + /// </summary> + public string irIndex = string.Empty; + + } } -- Gitblit v1.8.0