| | |
| | | /// <summary> |
| | | /// 添加遥控器的方法 |
| | | /// </summary> |
| | | public void AddControl() |
| | | public void AddControl(FrameLayout frameLayout) |
| | | { |
| | | View.TipView tipView = new View.TipView(); |
| | | tipView.InputBox("", (s, dialog) => |
| | | tipView.InputBox(frameLayout,"", (name, frame) => |
| | | { |
| | | ///清除之前列表数据 |
| | | Pir.BuottonList.Clear(); |
| | | if (!string.IsNullOrEmpty(s)) |
| | | if (!string.IsNullOrEmpty(name)) |
| | | { |
| | | Control control = new Control(); |
| | | control.name = s; |
| | | control.name = name; |
| | | control.type = "learn"; |
| | | |
| | | ThreadAddControl(control, dialog); |
| | | ThreadAddControl(control, frame,false); |
| | | |
| | | |
| | | |
| | |
| | | /// 发送遥控器命令方法 |
| | | /// </summary> |
| | | /// <param name="control"></param> |
| | | /// <param name="dialog"></param> |
| | | public void ThreadAddControl(Control control, Dialog dialog) { |
| | | /// <param name="frame"></param> |
| | | public void ThreadAddControl(Control control, FrameLayout frame,bool bool_library) { |
| | | |
| | | DAL.Server.ResponsePackNew responsePackNew = null; |
| | | Loading loading = new Loading(); |
| | | dialog.AddChidren(loading); |
| | | frame.AddChidren(loading); |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | responsePackNew = PirSend.Add(control); |
| | | responsePackNew = PirSend.Add(control, bool_library); |
| | | } |
| | | catch { } |
| | | finally |
| | |
| | | //{ |
| | | if (!string.IsNullOrEmpty(Sid("sid"))) { } |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | dialog.Close();//添加成功关闭弹窗 |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | frame.RemoveFromParent();//添加成功关闭弹窗 |
| | | if (bool_library) { |
| | | MainPage.BasePageView.RemoveViewByTag("PirView"); |
| | | AddControlComplete addControlComplete = new AddControlComplete(); |
| | | MainPage.BasePageView.AddChidren(addControlComplete); |
| | | addControlComplete.Show(control, bool_library); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | |
| | | //监听Mqtt推送下来状态码做提示 |
| | | //View.FailView failView = new View.FailView(); |
| | |
| | | { 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> |
| | |
| | | |
| | | } |
| | | } |
| | | [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; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |