From af9c3e0b3b1eb370e966b3ca9db3f62848d4189b Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期六, 21 八月 2021 13:03:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/newBranch1' into WJC

---
 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/SensorEnvironmentManagerPage.cs |  133 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/SensorEnvironmentManagerPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/SensorEnvironmentManagerPage.cs
new file mode 100644
index 0000000..b952725
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/SensorEnvironmentManagerPage.cs
@@ -0,0 +1,133 @@
+锘縰sing HDL_ON.DAL.Server;
+using HDL_ON.Entity;
+using HDL_ON.Stan;
+using HDL_ON.UI.UI2.PersonalCenter.PirDevice;
+using Shared;
+using System;
+
+namespace HDL_ON.UI
+{
+    /// <summary>
+    /// 娣诲姞姣背娉㈡楠�1鐣岄潰
+    /// </summary>
+    public class SensorEnvironmentManagerPage : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 娣诲姞璁惧瀹屾垚涔嬪悗鐨勫洖璋冧簨浠�
+        /// </summary>
+        public Action DelDeviceEvent = null;
+
+        Function function = null;
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        public void ShowForm(Function device)
+        {
+            function = device;
+            //璁剧疆澶撮儴淇℃伅
+            base.SetTitleText(Language.StringByID(StringId.Add) + device.name);
+            //杩欎釜鐣岄潰鐨勮儗鏅渶瑕佺櫧鑹�
+            bodyFrameLayout.BackgroundColor = CSS.CSS_Color.BackgroundColor;
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            this.InitMiddleFrame();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            //鍥剧墖
+            var btnPic = new PicViewControl(132, 132);
+            btnPic.Y = Application.GetRealHeight(69);
+            btnPic.Gravity = Gravity.CenterHorizontal;
+            btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/SenesorMegahealthBg.png";
+            bodyFrameLayout.AddChidren(btnPic);
+
+            var btnTip = new Button()
+            {
+                Y = Application.GetRealHeight(309 - 44),
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(319),
+                Height = Application.GetRealHeight(84),
+                IsMoreLines = true,
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+                TextSize = CSS.CSS_FontSize.SubheadingFontSize,
+            };
+            bodyFrameLayout.AddChidren(btnTip);
+
+            if (Language.CurrentLanguage == "Chinese")
+            {
+                btnTip.Text = "璇ヨ澶囧凡娣诲姞鍒颁紶鎰熷櫒绫诲埆锛屽彲鍒板搴斿姛鑳芥澘鍧楁煡鐪�";
+            }
+            else
+            {
+                btnTip.Text = "The device has been added to the sensor category, which can be viewed in the corresponding function block.";
+            }
+
+            var btnDel = new Button()
+            {
+                Y = Application.GetRealHeight(617 - 64),
+                Height = Application.GetRealHeight(50),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS.CSS_Color.WarningColor,
+                TextSize = CSS.CSS_FontSize.SubheadingFontSize,
+                TextID = StringId.DeleteDevice,
+                BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
+            };
+            bodyFrameLayout.AddChidren(btnDel);
+
+            btnDel.MouseUpEventHandler = (sender, e) => {
+                var pack = PirSend.DeleteDevice(function.deviceId);
+                if (pack.Code == StateCode.SUCCESS)
+                {
+                    DelDeviceEvent?.Invoke();
+                    this.CloseForm();
+                    var mes = "";
+                    if (Language.CurrentLanguage == "Chinese")
+                    {
+                        mes = "璁惧鍒犻櫎鎴愬姛銆�";
+                    }
+                    else
+                    {
+                        mes = "Device deleted successfully.";
+                    }
+                    var tip = new Tip()
+                    {
+                        Text = mes,
+                        CloseTime = 2,
+                        Direction = AMPopTipDirection.None
+                    };
+                    tip.Show(MainPage.BaseView);
+                }
+                else
+                {
+                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                }
+            };
+
+        }
+
+        #endregion
+
+        #region 鈻� 鍏抽棴鐣岄潰___________________________
+
+        /// <summary>
+        /// 鍏抽棴鐣岄潰
+        /// </summary>
+        public override void CloseFormBefore()
+        {
+            this.DelDeviceEvent = null;
+            base.CloseFormBefore();
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0