From 981ccd4afab6271422d7f169b30a2efa55eafde1 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 26 二月 2021 16:18:16 +0800 Subject: [PATCH] Merge branch 'WJC' into temp-wxr --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 101 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs new file mode 100644 index 0000000..0c7d14f --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -0,0 +1,101 @@ +锘縰sing System; +using HDL_ON.DAL.Server; +using Shared; + +namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice +{ + public class Method + { + /// <summary> + /// 娣诲姞閬ユ帶鍣ㄧ殑鏂规硶 + /// </summary> + public void AddControl() + { + View.TipView tipView = new View.TipView(); + tipView.InputBox("", (s, dialog) => + { + ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁 + Pir.BuottonList.Clear(); + if (!string.IsNullOrEmpty(s)) + { + Control control = new Control(); + control.name = s; + control.type = "learn"; + + ThreadAddControl(control,dialog); + + + + } + },false); + + } + /// <summary> + /// 鍙戦�侀仴鎺у櫒鍛戒护鏂规硶 + /// </summary> + /// <param name="control"></param> + /// <param name="dialog"></param> + public void ThreadAddControl(Control control, Dialog dialog) { + + DAL.Server.ResponsePackNew responsePackNew = null; + Loading loading = new Loading(); + dialog.AddChidren(loading); + loading.Start(); + new System.Threading.Thread(() => + { + try + { + responsePackNew = PirSend.Add(control); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + //{ + ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� + dialog.Close();//娣诲姞鎴愬姛鍏抽棴寮圭獥 + 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(); + //failView.ShouError((view) => { + // view.Close(); + // ThreadAddControl(control, dialog); + //}); + //} + //else + //{ + // ErrorShow(responsePackNew); + //} + }); + } + }) + { IsBackground = true }.Start(); + + } + /// <summary> + /// 閿欒鐮佹彁绀� + /// </summary> + /// <param name="responsePackNew"></param> + public void ErrorShow(ResponsePackNew responsePackNew) + { + + if (responsePackNew != null && responsePackNew.Code == "14005") + { + new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); + + } + else + { + new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); + + } + } + } +} -- Gitblit v1.8.0