| | |
| | | /// |
| | | /// </summary> |
| | | /// <param name="list">表示该列表元素A-Z字母筛选显示出来</param> |
| | | /// <param name="list6">表示该列表元素显示在list前面(该列表元素不做A-Z字母筛选),没有可以为list6=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进度转换成byte |
| | | // bytes[i] = Convert.ToByte(text.Substring(j, 2), 16); |
| | | //} |
| | | ////把byte数组转换成文字 |
| | | //string str = System.Text.Encoding.UTF8.GetString(bytes); |
| | | |
| | | var frameLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTop, |
| | |
| | | { |
| | | 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); |
| | |
| | | listStr.Add(s); |
| | | } |
| | | } |
| | | RefreshLayout(vv, listStr); |
| | | RefreshLayout(vv, brandList, listStr,spk); |
| | | |
| | | }; |
| | | #region A-Z |
| | |
| | | } |
| | | #endregion |
| | | |
| | | RefreshLayout(vv, list1); |
| | | RefreshLayout(vv, brandList, list1,spk); |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | /// </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) |
| | |
| | | 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=包含,false=不包含) |
| | |
| | | else return ("ZZ"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |