From efad979b6fae76fb37a4de7e94e6bac0a85cb72c Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 30 十一月 2021 13:14:28 +0800
Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。

---
 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs |   96 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 75 insertions(+), 21 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs
index d590b9b..f274fbb 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs
@@ -7,7 +7,7 @@
 namespace HDL_ON.UI
 {
     /// <summary>
-    /// 娣诲姞姣背娉㈡楠�1鐣岄潰
+    /// 娣诲姞鐜浼犳劅鍣ㄦ楠�1鐣岄潰
     /// </summary>
     public class AddSensorEnvironmentPage : EditorCommonForm
     {
@@ -18,6 +18,8 @@
         /// </summary>
         public Action<Function> AddDeviceEvent = null;
 
+        IntegratedBrandDevice integratedDevice = null;
+
         #endregion
 
         #region 鈻� 鍒濆鍖朹____________________________
@@ -26,6 +28,7 @@
         /// </summary>
         public void ShowForm(IntegratedBrandDevice device)
         {
+            integratedDevice = device;
             if (Language.CurrentLanguage == "Chinese")
             {
                 //璁剧疆澶撮儴淇℃伅
@@ -51,7 +54,18 @@
             var btnPic = new PicViewControl(132, 132);
             btnPic.Y = Application.GetRealHeight(69);
             btnPic.Gravity = Gravity.CenterHorizontal;
-            btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/SenesorMegahealthBg.png";
+            if (integratedDevice.spk == SPK.SensorEnvironment3)
+            {
+                btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/EnvirSensorQingpingLitebg.png";
+            }
+            else if (integratedDevice.spk == SPK.SensorEnvironment2)
+            {
+                btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/EnvirSensorQingpingCGS1bg.png";
+            }
+            else
+            {
+                btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/EnvironmentalSensorbg.png";
+            }
             bodyFrameLayout.AddChidren(btnPic);
 
             //璇疯緭鍏ヨ澶囨満涓婄殑sn鐮�
@@ -75,26 +89,59 @@
             };
             textView.AddChidren(editText);
 
-            Button btnScan = new Button()
+            string pairString = "";
+            if (integratedDevice.spk == SPK.SensorEnvironment2)
             {
-                Width = Application.GetRealWidth(32),
-                Height = Application.GetRealWidth(32),
-                Gravity = Gravity.CenterVertical,
-                X = Application.GetRealWidth(275),
-                UnSelectedImagePath = "Public/Scan.png"
-            };
-            textView.AddChidren(btnScan);
-            btnScan.MouseUpEventHandler = (sender, e) =>
-            {
-                Scan.OpenScan((scanString) =>
+                //璇疯緭鍏ヨ澶囨満涓婄殑閰嶅鐮�
+                var pairView = new FrameLayout()
                 {
-                    editText.Text = scanString;
-                });
-            };
+                    Y = Application.GetRealHeight(309),
+                    Gravity = Gravity.CenterHorizontal,
+                    Width = Application.GetRealWidth(319),
+                    Height = Application.GetRealHeight(44),
+                };
+                bodyFrameLayout.AddChidren(pairView);
+                pairView.AddChidren(new Button() { Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS.CSS_Color.DividingLineColor });
+
+                EditText pairText = new EditText()
+                {
+                    TextAlignment = TextAlignment.Center,
+                    TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+                    PlaceholderText = Language.StringByID(StringId.PlsEntryPairCode),
+                    PlaceholderTextColor = CSS.CSS_Color.PromptingColor1,
+                    TextSize = CSS.CSS_FontSize.TextFontSize,
+                };
+                pairView.AddChidren(pairText);
+
+                pairText.TextChangeEventHandler = (sender, e) => {
+                    pairString = e;
+                };
+            }
 
 
-
-
+            if (integratedDevice.spk == SPK.SensorEnvironment2 || integratedDevice.spk == SPK.SensorEnvironment3)
+            {
+                editText.PlaceholderText = Language.StringByID(StringId.PlsEntryMacCode);
+            }
+            if (integratedDevice.spk == SPK.SensorEnvironment)
+            {
+                Button btnScan = new Button()
+                {
+                    Width = Application.GetRealWidth(32),
+                    Height = Application.GetRealWidth(32),
+                    Gravity = Gravity.CenterVertical,
+                    X = Application.GetRealWidth(275),
+                    UnSelectedImagePath = "Public/Scan.png"
+                };
+                textView.AddChidren(btnScan);
+                btnScan.MouseUpEventHandler = (sender, e) =>
+                {
+                    Scan.OpenScan((scanString) =>
+                    {
+                        editText.Text = scanString;
+                    });
+                };
+            }
             //涓嬩竴姝�
             var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next));
             btnNext.ButtonClickEvent += (sender, e) =>
@@ -113,7 +160,7 @@
                         try
                         {
                             var pm = new HttpServerRequest();
-                            var pack = pm.IndependentRegister3TyDevcie(SPK.SensorEnvironment, snCode, Language.StringByID(StringId.SensorEnvironment));
+                            var pack = pm.IndependentRegister3TyDevcie(integratedDevice.spk, snCode,integratedDevice.productName,pairString);// Language.StringByID(StringId.SensorEnvironment)
                             if (pack.Code == StateCode.SUCCESS)
                             {
                                 //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrandDevice>>(pack.Data.ToString());
@@ -121,7 +168,7 @@
                                 {
                                     waitPage.Hide();
                                     var tipDialog = new OperationResultDisPalyPage();
-                                    tipDialog.LoadPage(true, Language.StringByID(StringId.AddSuccess), "", Language.StringByID(StringId.CanStartUsingZhaoguanMillimeterWave), Language.StringByID(StringId.Next));
+                                    tipDialog.LoadPage(true, Language.StringByID(StringId.AddSuccess), "", Language.StringByID(StringId.CanStartUsingEnvironmentalSensor), Language.StringByID(StringId.Next));
                                     tipDialog.Show();
                                     AddDeviceEvent?.Invoke(new Function());
                                     this.CloseForm();
@@ -160,7 +207,14 @@
                         }
                         finally
                         {
-                            Application.RunOnMainThread(() => { waitPage.Hide(); });
+                            Application.RunOnMainThread(() =>
+                            {
+                                if (waitPage != null)
+                                {
+                                    waitPage.RemoveFromParent();
+                                    waitPage = null;
+                                }
+                            });
                         }
                     })
                     { IsBackground = true }.Start();

--
Gitblit v1.8.0