From 0d1b995a55d2c9a049550b28f72ca0265ca588f0 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期四, 04 三月 2021 19:49:58 +0800 Subject: [PATCH] 2021-3-4-2 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 60 +++++++++++++++++++++++++++--------------------------------- 1 files changed, 27 insertions(+), 33 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs index f462d97..4825826 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -11,7 +11,7 @@ /// <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) => @@ -23,8 +23,9 @@ Control control = new Control(); control.name = name; control.type = "learn"; + control.spk = "ir.learn"; - ThreadAddControl(control, frame,false); + ThreadAddControl(control, frame, action); @@ -37,7 +38,7 @@ /// </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(); @@ -47,7 +48,7 @@ { try { - responsePackNew = PirSend.Add(control, bool_library); + responsePackNew = PirSend.Add(control); } catch { } finally @@ -55,39 +56,32 @@ Application.RunOnMainThread(() => { loading.Hide(); - //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - //{ - if (!string.IsNullOrEmpty(Sid("sid"))) { } - ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� - 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() != "") + { + string sid = 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 + { + ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� + 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); - //} }); } }) -- Gitblit v1.8.0