From 8e5ba5665861b29a4b8da0335c81d620aa891862 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 08 三月 2021 09:23:54 +0800 Subject: [PATCH] Merge branch 'WJC' into temp-wxr --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs | 80 ++++++++++++++++++++++++++++----------- 1 files changed, 57 insertions(+), 23 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..0f62f69 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs @@ -16,18 +16,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,string spk) { - //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, @@ -97,12 +88,7 @@ { list = new List<string>(); } - if (list6 == null) - { - list6 = new List<string>(); - } var list1 = GetDateList(list); - list1.InsertRange(0, list6); var vv = new VerticalScrolViewLayout(); fram.AddChidren(vv); @@ -119,7 +105,7 @@ listStr.Add(s); } } - RefreshLayout(vv, listStr); + RefreshLayout(vv, brandList, listStr,spk); }; #region A-Z @@ -176,7 +162,7 @@ } #endregion - RefreshLayout(vv, list1); + RefreshLayout(vv, brandList, list1,spk); } /// <summary> @@ -184,7 +170,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,string spk) { vv.RemoveAll(); foreach (var str in list) @@ -224,14 +210,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(libraryList, spk); + 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 (libraryList.Count<20) + { + libraryList.Add(library); + } + } + } + actionBrand(libraryList); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + }, id, "鍝佺墝绾㈠鐮佸簱鍒楄〃"); } /// <summary> /// 鍒楄〃鏄惁鍖呭惈璇ュ��(true=鍖呭惈锛宖alse=涓嶅寘鍚�) @@ -431,5 +463,7 @@ else return ("ZZ"); } } + + } -- Gitblit v1.8.0