| | |
| | | using System; |
| | | using HDL_ON.DAL.Server; |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice |
| | | { |
| | |
| | | loading.Hide(); |
| | | //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | //{ |
| | | if (!string.IsNullOrEmpty(Sid("sid"))) { } |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | dialog.Close();//添加成功关闭弹窗 |
| | | AddButton addButton = new AddButton(); |
| | |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | public List<DD> GetLsit(FrameLayout frameLayout, Action<ResponsePackNew> action, string id, string if_str) |
| | | { |
| | | List<DD> list = new List<DD>(); |
| | | ResponsePackNew responsePackNew = null; |
| | | PirSend.GetDeviceTypesList(frameLayout, action, id, if_str); |
| | | |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | var jArray = JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | var jay = jArray[a]; |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DD>>(str); |
| | | |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | } |
| | | return list; |
| | | } |
| | | /// <summary> |
| | | /// MQTT主题推送下来的数据(遥控器添加) |
| | | /// </summary> |
| | | public static string addcontronsid = ""; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="sid"></param> |
| | | /// <returns></returns> |
| | | public string Sid(string sid) |
| | | { |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 5* 1000) |
| | | { |
| | | if (!string.IsNullOrEmpty(addcontronsid) && addcontronsid == sid) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | } |
| | | return addcontronsid; |
| | | } |
| | | /// <summary> |
| | | /// 错误码提示 |
| | | /// </summary> |
| | |
| | | |
| | | } |
| | | } |
| | | [Serializable] |
| | | public class DD |
| | | { |
| | | /// <summary> |
| | | /// 设备类型主键Id |
| | | /// </summary> |
| | | public string id=string.Empty; |
| | | /// <summary> |
| | | /// 设备类型(投影仪,风扇,机顶盒...) |
| | | /// </summary> |
| | | public string deviceType = string.Empty; |
| | | /// <summary> |
| | | ///品牌名称 |
| | | /// </summary> |
| | | public string brandName = string.Empty; |
| | | /// <summary> |
| | | /// 红外码 |
| | | /// </summary> |
| | | public string irCode = string.Empty; |
| | | /// <summary> |
| | | /// 品牌主键Id |
| | | /// </summary> |
| | | public string brandId = string.Empty; |
| | | /// <summary> |
| | | /// 红外码索引序号 |
| | | /// </summary> |
| | | public string irIndex = string.Empty; |
| | | } |
| | | } |
| | | } |