From 5eec2e8c16bdcb163b388de486ee375e891df445 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 25 二月 2021 17:54:15 +0800
Subject: [PATCH] 2021-2-25-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs |   88 +++++++++++++++++++++----------------------
 1 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
index f6e3b65..539cbd3 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -4,7 +4,7 @@
 using Shared;
 namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
 {
-    public class AddButton:FrameLayout
+    public class AddButton : FrameLayout
     {
         public AddButton()
         {
@@ -97,69 +97,67 @@
             #endregion
             View.Buttons buttons = new View.Buttons();
             var buttonNameList = buttons.GetList("榛樿鎸夐挳");
-            buttons.AddButton(buttonFLayout, buttonNameList, (s) => {
+            buttons.AddButton(buttonFLayout, buttonNameList, (s) =>
+            {
                 editText.Text = s;
-               #if __Android__
+#if __Android__
                 editText.SetSelectionEnd();
-               #endif
+#endif
             });
             ///涓嬩竴姝ョ殑鐐瑰嚮浜嬩欢
             saveBtn.MouseUpEventHandler += (sender, e) =>
             {
-                View.ReplicationView replication = new View.ReplicationView();
-                //new寮曞鐣岄潰
-                replication.GuideShow();
-
                 var texts = editText.Text.Trim();
-                if (string.IsNullOrEmpty( editText.Text)) {
+                if (string.IsNullOrEmpty(editText.Text))
+                {
                     //鍚嶇О涓嶈兘涓虹┖
                     return;
                 }
                 var butName = Pir.BuottonList.Find((c) => c.value == texts);
-                if (butName!=null) {
+                if (butName != null)
+                {
                     //鍚嶇О宸茬粡瀛樺湪
                     return;
                 }
-              
+                //new寮曞鐣岄潰
+                ReplicationView replication = new ReplicationView();
+                MainPage.BasePageView.AddChidren(replication);
+                replication.Show();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
                 //娣诲姞鏁版嵁瀵硅薄
                 ButtonObj buttonObj = new ButtonObj();
                 buttonObj.Key = "key" + Pir.BuottonList.Count.ToString();
                 buttonObj.value = texts;
-              
-                HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-                new System.Threading.Thread(() =>
-                {
-
-                    try
-                    {
-                        //鍙戦�佺孩澶栫爜瀛︿範鍛戒护
-                        responsePackNew = PirSend.CodeStudy(buttonObj);
-                    }
-                    catch { }
-                    finally
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            if (PirSend.Error(responsePackNew))
-                            {
-                                //娣诲姞鏁版嵁
-                                Pir.BuottonList.Add(buttonObj);
-                                //绉婚櫎娣诲姞鎸夐挳鐣岄潰
-                                this.RemoveFromParent();
-                                //鍔犺浇鏁版嵁鐣岄潰
-                                AddControl addControl = new AddControl();
-                                addControl.Show();
-                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                            }
-                            //绉婚櫎娣诲姞鎸夐挳寮曞鐣岄潰
-                         //  replication.dialog.Close();
-
-                        });
-                    }
-
-                })
-                { IsBackground = true }.Start();
                
+                PirSend.CodeStudy(buttonObj, (responsePackNew) =>
+                {
+                    //浼戠湢鏄负鏄剧ず寮曞鐣岄潰
+                  //  System.Threading.Thread.Sleep(5000);
+                    //绉婚櫎娣诲姞鎸夐挳寮曞鐣岄潰
+                    replication.RemoveFromParent();
+                    if (!PirSend.Error(responsePackNew))
+                    {
+                        var buttonName = Pir.BuottonList.Find((c) => c.value == buttonObj.value);
+                        if (buttonName == null)
+                        {
+                            //娣诲姞鏁版嵁
+                            Pir.BuottonList.Add(buttonObj);
+                        }
+                        //绉婚櫎娣诲姞鎸夐挳鐣岄潰
+                        this.RemoveFromParent();
+                        //绉婚櫎涔嬪墠鐨勭晫闈�
+                        MainPage.BasePageView.RemoveViewByTag("AddControl");
+                        //鍔犺浇鏁版嵁鐣岄潰
+                        AddControl addControl = new AddControl();
+                        MainPage.BasePageView.AddChidren(addControl);
+                        addControl.Show();
+                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    }
+
+                });
+
+
             };
 
         }

--
Gitblit v1.8.0