| | |
| | | /// <summary> |
| | | /// 获取遥控器列表 |
| | | /// </summary> |
| | | public static void GetControlList(Action actio) |
| | | /// <param name="action">回调函数</param> |
| | | public static void GetControlList(Action action) |
| | | { |
| | | |
| | | new System.Threading.Thread(() => |
| | |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | actio(); |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取遥控器列表 |
| | | /// </summary> |
| | | /// <param name="frame">log图标加载界面</param> |
| | | /// <param name="action">回调函数</param> |
| | | public static void GetControlList1(FrameLayout frame, Action action) |
| | | { |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | frame.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | for (int i = 0; i < Pir.pirDeviceList.Count; i++) |
| | | { |
| | | var pirDevice = Pir.pirDeviceList[i]; |
| | | try |
| | | { |
| | | responsePackNew = PirSend.ControlList(pirDevice); |
| | | |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | var jay = jArray[a]; |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); |
| | | if (pirJosn != null) |
| | | { |
| | | if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid)) |
| | | { |
| | | pirDevice.FunctioList.Add(pirJosn); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch { } |
| | | |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | action(); |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |