| | |
| | | /// <summary> |
| | | /// 添加遥控器的方法 |
| | | /// </summary> |
| | | public void AddControl(FrameLayout frameLayout) |
| | | public void AddControl(FrameLayout frameLayout,Action<Control> action) |
| | | { |
| | | View.TipView tipView = new View.TipView(); |
| | | tipView.InputBox(frameLayout,"", (name, frame) => |
| | |
| | | control.name = name; |
| | | control.type = "learn"; |
| | | |
| | | ThreadAddControl(control, frame,false); |
| | | ThreadAddControl(control, frame, action); |
| | | |
| | | |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="control"></param> |
| | | /// <param name="frame"></param> |
| | | public void ThreadAddControl(Control control, FrameLayout frame,bool bool_library) { |
| | | public void ThreadAddControl(Control control, FrameLayout frame,Action<Control> action) { |
| | | |
| | | DAL.Server.ResponsePackNew responsePackNew = null; |
| | | Loading loading = new Loading(); |
| | |
| | | { |
| | | try |
| | | { |
| | | responsePackNew = PirSend.Add(control, bool_library); |
| | | responsePackNew = PirSend.Add(control); |
| | | } |
| | | catch { } |
| | | finally |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | //{ |
| | | if (!string.IsNullOrEmpty(Sid("sid"))) { } |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | 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; |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | if (!string.IsNullOrEmpty(Sid("sid"))) |
| | | { |
| | | //监听Mqtt推送下来状态码做提示 |
| | | View.FailView failView = new View.FailView(); |
| | | failView.ShouError((view) => |
| | | { |
| | | view.Close(); |
| | | ThreadAddControl(control, frame, action); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | frame.RemoveFromParent();//添加成功关闭弹窗 |
| | | action(control); |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | ErrorShow(responsePackNew); |
| | | } |
| | | |
| | | //监听Mqtt推送下来状态码做提示 |
| | | //View.FailView failView = new View.FailView(); |
| | | //failView.ShouError((view) => { |
| | | // view.Close(); |
| | | // ThreadAddControl(control, dialog); |
| | | //}); |
| | | //} |
| | | //else |
| | | //{ |
| | | // ErrorShow(responsePackNew); |
| | | //} |
| | | }); |
| | | } |
| | | }) |