| | |
| | | /// <param name="list">当前存在名称列表</param> |
| | | /// <param name="currName">当前名称</param> |
| | | /// <param name="action">回调函数</param> |
| | | public void EditControlName(int tipText ,List<string> list, string currName, Action<string, Dialog> action,Action actionCancel, bool tag=false) |
| | | public void EditControlName(int tipText, List<string> list, string currName, Action<string, Dialog> action, Action actionCancel, bool tag = false) |
| | | { |
| | | new View.TipView().InputBox(tipText, currName, StringId.nameNull, StringId.NameAlreadyExists, list, (text, view |
| | | ) => |
| | | { |
| | | action(text,view); |
| | | action(text, view); |
| | | }, () => { actionCancel(); }, tag); |
| | | } |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | } |
| | | //GetControlList(frame, action); |
| | | // GetControlList(); |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | |
| | | // action(); |
| | | try |
| | | { |
| | | if (Pir.pirDeviceList.Count != 0) |
| | | { |
| | | GetControlList1(frame, action); |
| | | var list = Pir.pirDeviceList; |
| | | GetControlList(() => |
| | | { |
| | | loading.Hide(); |
| | | action(); |
| | | |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //Method method = new Method(); |
| | | //method.ErrorShow(responsePackNew); |
| | | loading.Hide(); |
| | | Method method = new Method(); |
| | | method.ErrorShow(null,"读取红外宝列表失败"); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | /// <summary> |
| | | /// 获取遥控器列表 |
| | | /// </summary> |
| | | public static void GetControlList() |
| | | public static void GetControlList(Action actio) |
| | | { |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | |
| | | for (int i = 0; i < Pir.pirDeviceList.Count; i++) |
| | | try |
| | | { |
| | | var pirDevice = Pir.pirDeviceList[i]; |
| | | try |
| | | for (int i = 0; i < Pir.pirDeviceList.Count; i++) |
| | | { |
| | | var responsePackNew = PirSend.ControlList(pirDevice); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | var pirDevice = Pir.pirDeviceList[i]; |
| | | try |
| | | { |
| | | var jArray = JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | var responsePackNew = PirSend.ControlList(pirDevice); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | var jay = jArray[a]; |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); |
| | | if (pirJosn != null) |
| | | var jArray = JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid)) |
| | | var jay = jArray[a]; |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); |
| | | if (pirJosn != null) |
| | | { |
| | | pirDevice.FunctioList.Add(pirJosn); |
| | | if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid)) |
| | | { |
| | | pirDevice.FunctioList.Add(pirJosn); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch { } |
| | | |
| | | } |
| | | catch { } |
| | | |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | actio(); |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | /// </summary> |
| | | /// <param name="responsePackNew"></param> |
| | | /// <param name="str"></param> |
| | | public void ErrorShow(ResponsePackNew responsePackNew, string str = "") |
| | | public void ErrorShow(ResponsePackNew responsePackNew=null, string str = "") |
| | | { |
| | | if (str == "删除遥控器") |
| | | { |
| | | new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail)); |
| | | } else if (str == "读取红外宝列表失败") { |
| | | |
| | | new Intelligence.Automation.LogicView.TipPopView().FlashingBox("读取红外宝列表失败"); |
| | | } |
| | | else |
| | | { |