| | |
| | | public PirMain() |
| | | { |
| | | Tag = "PirMain"; |
| | | GetPirDeviceList(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 临时储存设备类型列表 |
| | |
| | | Text = "mini智能遥控器", |
| | | }; |
| | | deviceListFLayout.AddChidren(deviceNameBtn); |
| | | if (Pir.pirDeviceList.Count!=0) { |
| | | if (Pir.pirDeviceList.Count != 0) |
| | | { |
| | | deviceNameBtn.Text = Pir.pirDeviceList[0].name; |
| | | Pir.currPir = Pir.pirDeviceList[0]; |
| | | } |
| | |
| | | if (if_value == 7) |
| | | { |
| | | Method method = new Method(); |
| | | method.AddControl(this,(control) => { |
| | | method.AddControl(this, (control) => |
| | | { |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control); |
| | |
| | | } |
| | | |
| | | } |
| | | Application.RunOnMainThread(()=> { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | BrandList brandObj = new BrandList(); |
| | | MainPage.BasePageView.AddChidren(brandObj); |
| | | brandObj.Show(brandList, strList, strings[1]); |
| | |
| | | } |
| | | }, "", "设备类型列表"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取红外设备类型的品牌列表 |
| | | /// </summary> |
| | |
| | | } |
| | | }, id, "品牌列表"); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取红外设备列表 |
| | | /// </summary> |
| | | private void GetPirDeviceList( ) |
| | | { |
| | | |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | this.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | responsePackNew = PirSend.GetDeviceList("ir.module"); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | try { |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString()); |
| | | string list = jobject["list"].ToString(); |
| | | |
| | | var jArray = Newtonsoft.Json.Linq.JArray.Parse(list); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | var jay = jArray[a]; |
| | | string spk = jay["spk"].ToString(); |
| | | if (spk == "ir.module") |
| | | { |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str); |
| | | if (pirJosn != null) |
| | | { |
| | | if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) |
| | | { |
| | | |
| | | Pir.pirDeviceList.Add(pirJosn); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | } |
| | | } |
| | | catch { } |
| | | |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |