From 8123d0298c0fed448bddc956059126a4875782c2 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 23 三月 2021 18:02:38 +0800
Subject: [PATCH] 2021-3-23-2

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs       |   22 ++++++-
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs    |    8 +-
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs      |   15 +++-
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs |   21 ------
 .vs/HDL_APP_Project/xs/UserPrefs.xml                     |   41 ++++++++-----
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs      |    4 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs |    2 
 HDL-ON_Android/Application.cs                            |   10 ++-
 HDL-ON_Android/Other/JPush/JPushReceiver.cs              |    5 -
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs       |    3 
 10 files changed, 73 insertions(+), 58 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index eb2bdde..53ff4f7 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,40 +1,49 @@
 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
-  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/MyQRCodePage.cs">
     <Files>
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="12" Column="60" IsPinned="True" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="135" Column="75" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs" Line="1" Column="1" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="132" Column="58" IsPinned="True" />
+      <File FileName="../../Application.cs" Line="16" Column="35" IsPinned="True" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="16" Column="13" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs" Line="237" Column="71" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs" Line="3" Column="55" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="20" Column="23" />
-      <File FileName="HDL-ON_Android/Application.cs" Line="393" Column="33" />
-      <File FileName="../../Application.cs" Line="257" Column="45" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="183" Column="48" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="97" Column="10" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="24" Column="12" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="527" Column="23" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="449" Column="22" />
+      <File FileName="HDL_ON/Entity/Function/Function.cs" Line="1339" Column="31" />
+      <File FileName="HDL-ON_Android/Application.cs" Line="365" Column="29" />
+      <File FileName="HDL_ON/Common/HDLCommon.cs" Line="253" Column="72" />
+      <File FileName="HDL-ON_iOS/AppDelegate.cs" Line="356" Column="53" />
+      <File FileName="HDL-ON_Android/Other/JPush/JPushReceiver.cs" Line="27" Column="22" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs" Line="17" Column="21" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="153" Column="113" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/MyQRCodePage.cs" Line="19" Column="1" />
+      <File FileName="HDL-ON_Android/Scan.cs" Line="14" Column="59" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
         <State name="__root__">
           <Node name="HDL_APP_Project" expanded="True">
             <Node name="HDL_ON" expanded="True">
+              <Node name="Common" expanded="True" />
               <Node name="DAL" expanded="True">
-                <Node name="Mqtt" expanded="True" />
+                <Node name="Server" expanded="True" />
+              </Node>
+              <Node name="Entity" expanded="True">
+                <Node name="Function" expanded="True" />
               </Node>
               <Node name="UI" expanded="True">
                 <Node name="UI2" expanded="True">
                   <Node name="4-PersonalCenter" expanded="True">
-                    <Node name="AddDevice" expanded="True" />
-                    <Node name="AddFunction" expanded="True" />
                     <Node name="PirDevice" expanded="True">
-                      <Node name="AddControl.cs" selected="True" />
+                      <Node name="View" expanded="True" />
                     </Node>
+                    <Node name="MyQRCodePage.cs" selected="True" />
                   </Node>
                 </Node>
               </Node>
             </Node>
             <Node name="HDL-ON_Android" expanded="True">
-              <Node name="Resources" expanded="True" />
+              <Node name="Other" expanded="True">
+                <Node name="JPush" expanded="True" />
+              </Node>
             </Node>
           </Node>
         </State>
diff --git a/HDL-ON_Android/Application.cs b/HDL-ON_Android/Application.cs
index 4f9f009..bb0bab8 100644
--- a/HDL-ON_Android/Application.cs
+++ b/HDL-ON_Android/Application.cs
@@ -28,7 +28,7 @@
             application.StartActivity(intent);
             Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
         }
-        
+
         public Application(IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip) : base(handle, ownerShip) { }
         public override void OnCreate()
         {
@@ -46,6 +46,8 @@
             initAll();
 
         }
+
+
 
         /// <summary>
         /// 鎵�鏈夊垵濮嬪寲鍏ㄩ儴鍦ㄨ繖涓柟娉曞疄鐜�
@@ -135,6 +137,7 @@
             {
                 checkSomeInfo();
 
+
             };
             BaseActivity.OnDestroyAction += (activity) =>
             {
@@ -174,9 +177,10 @@
         /// <param name="activity"></param>
         void GetJPushRegistrationID(BaseActivity activity)
         {
-          
+
             try
             {
+
                 //淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠�
                 var tokenID = JPushInterface.GetRegistrationID(activity);
                 Console.WriteLine("RegistrationID:  " + tokenID);
@@ -366,7 +370,7 @@
             //杩涘叆鍚庡彴mqtt姝e湪杩炴帴閲嶇疆鐘舵��
             HDL_ON.DAL.Mqtt.MqttClient.RemoteMqttIsConnecting = false;
             HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop();
-           
+
         }
 
         /// <summary>
diff --git a/HDL-ON_Android/Other/JPush/JPushReceiver.cs b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
index ff8a03b..48ee1fc 100644
--- a/HDL-ON_Android/Other/JPush/JPushReceiver.cs
+++ b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -98,7 +98,6 @@
         public override void OnRegister(Context context, string p1)
         {
             base.OnRegister(context, p1);
-
             Utlis.WriteLine("JPushOnRegister: " + p1);
         }
 
@@ -112,8 +111,6 @@
         //{
         //    try
         //    {
-               
-
         //        if (JPushMessageInfo.Extras.Contains("Offline") == true)
         //        {
         //            Shared.Application.RunOnMainThread(() =>
@@ -141,7 +138,7 @@
         //}
 
         /// <summary>
-        /// 鎵撳紑娑堟伅鏄剧ず鐣岄潰
+        /// 鎵撳紑娑堟伅鏄剧ず鐣岄潰.010000
         /// </summary>
         /// <param name="context"></param>
         /// <param name="notificationMessage"></param>
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
index cc1bc8e..cfacb7f 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -12,6 +12,7 @@
         }
         public void Show(Control control)
         {
+           
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
@@ -122,17 +123,14 @@
                 }
                 //new寮曞鐣岄潰
                 View.ReplicationView replication = new View.ReplicationView();
-               // MainPage.BasePageView.AddChidren(replication);
                 replication.Show(this);
-               // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-
 
                 //娣诲姞鏁版嵁瀵硅薄
                 Entity.AttributesStatus buttonObj = new Entity.AttributesStatus();
                 buttonObj.key = "key" + control.status.Count.ToString();
                 buttonObj.value = texts;
 
-                PirSend.CodeStudy(control, buttonObj, (responsePackNew) =>
+                PirSend.CodeStudy(control.deviceId, buttonObj, (responsePackNew) =>
                 {
                     if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                     {
@@ -191,5 +189,7 @@
             };
 
         }
+
+      
     }
 }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index e65cb76..122c30f 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -8,6 +8,7 @@
 {
     public class Method
     {
+       
         /// <summary>
         /// 绾㈠瀹濈▼搴忎富鍏ュ彛
         /// </summary>
@@ -15,7 +16,6 @@
         /// <param name="function"></param>
         public void MainView(FrameLayout frame, Entity.Function function,Action action)
         {
-
             Pir pirDevice = new Pir();
             if (function != null)
             {//鏁版嵁杞崲
@@ -23,6 +23,7 @@
                 pirDevice.deviceId = function.deviceId;
                 pirDevice.sid = function.sid;
                 pirDevice.online = function.online;
+                pirDevice.versions = function.versions;
             }
             Pir.currPir = pirDevice;
             GetControlList(frame, () =>
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
index 0be0bba..c1169c5 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -32,9 +32,8 @@
             this.AddChidren(topView.FLayoutView());
             topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
             {
-                BackAction();
-                BackAction = null;
-                this.RemoveFromParent();
+               
+                RemoveFromParent();
             };
 
             FrameLayout middFLayout = new FrameLayout();
@@ -519,7 +518,15 @@
                 }
             }, id, "鍝佺墝鍒楄〃");
         }
-
+        /// <summary>
+        /// 绉婚櫎鐣岄潰
+        /// </summary>
+        public override void RemoveFromParent()
+        {
+            BackAction();
+            BackAction = null;
+            base.RemoveFromParent();
+        }
 
     }
 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
index 957fb02..2529c83 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -150,7 +150,7 @@
         /// 绾㈠鐮佸涔�
         /// </summary>
         /// <returns></returns>
-        public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action)
+        public static void CodeStudy(string deviceId, AttributesStatus buttonObj,Action<ResponsePackNew> action)
         {
             var job = new JObject { };
             job.Add("key", buttonObj.key);
@@ -160,7 +160,7 @@
             job.Add("value", valuejArray);
             var jArray = new JArray { };
             jArray.Add(job);
-            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } };
+            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "attributes", jArray } };
             ResponsePackNew responsePackNew = null;
             new System.Threading.Thread(() =>
             {
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
index 95a465b..40ae860 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
@@ -12,16 +12,17 @@
         {
             Tag = "PirMain";
         }
-
+        Action backAction;
         public void Show(Action action)
         {
+            backAction = action;
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             Intelligence.Automation.LogicView.TopView topView = new Intelligence.Automation.LogicView.TopView();
             this.AddChidren(topView.FLayoutView());
             topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
             {
-                action();
+                //action();
                 RemoveFromParent();
             };
             topView.topNameBtn.TextID = StringId.setlogic;
@@ -46,10 +47,16 @@
             banbenshengjiFL.btnText.Text = Language.StringByID(StringId.banbenshengji);
             banbenshengjiFL.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
             viewLayout.AddChidren(banbenshengjiFL.FLayoutView());
+
+            var versions = Pir.currPir.versions.Find((c)=>c.module== "fw_version");
+            if (versions == null)
+            {
+                versions = new Entity.VersionInfo();
+            }
             ///鐗堟湰鍙�:v1.3.5
             FrameLayout50 banbenhaoFLayout = new FrameLayout50();
             banbenhaoFLayout.btnNextIcon.Visible = false;
-            banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":v1.3.5";
+            banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":"+ versions.version;
             banbenhaoFLayout.frameLayout.Y = banbenshengjiFL.frameLayout.Bottom;
             viewLayout.AddChidren(banbenhaoFLayout.FLayoutView());
             //鍒犻櫎
@@ -129,6 +136,13 @@
             #endregion
 
         }
-
+        /// <summary>
+        /// 绉婚櫎鐣岄潰
+        /// </summary>
+        public override void RemoveFromParent()
+        {
+            backAction();
+            base.RemoveFromParent();
+        }
     }
 }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs
index db38adc..fe2767c 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs
@@ -13,7 +13,7 @@
         /// <param name="buttonList">鏁版嵁鍒楄〃</param>
         /// <param name="action">鍥炶皟</param>
         /// <param name="line">琛ㄧず澶氬皯琛�</param>
-        /// <param name="line">琛ㄧず涓�琛屽姞杞藉灏戜釜鎸夐挳</param>
+        /// <param name="sum">琛ㄧず涓�琛屽姞杞藉灏戜釜鎸夐挳</param>
         public void AddButton(FrameLayout buttonFLayout, List<string> buttonList, Action<string> action, int line = 7, int sum = 3)
         {
             VerticalScrolViewLayout vv = new VerticalScrolViewLayout();
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs
index 27d39e7..1567c59 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs
@@ -47,28 +47,12 @@
             IsBold = true,
         };
 
-
-        /// <summary>
-        /// 鐗堟湰鍙�
-        /// </summary>
-        public Button versionBtn = new Button
-        {
-            Y = Application.GetRealHeight(40),
-            X = Application.GetRealWidth(72),
-            Width = Application.GetRealWidth(120),
-            Height = Application.GetRealHeight(17),
-            Text = "鐗堟湰鍙穠1.3.5",
-            TextAlignment = TextAlignment.CenterLeft,
-            TextSize = TextSize.text12,
-            TextColor = CSS.CSS_Color.textCancelColor,
-        };
-
         /// <summary>
         /// 褰撳墠涓暟
         /// </summary>
         public Button geBtn = new Button
         {
-            Y = Application.GetRealHeight(59),
+            Y = Application.GetRealHeight(40),
             X = Application.GetRealWidth(72),
             Width = Application.GetRealWidth(120),
             Height = Application.GetRealHeight(17),
@@ -83,7 +67,7 @@
         /// </summary>
         public Button sumBtn = new Button
         {
-            Y = Application.GetRealHeight(59),
+            Y = Application.GetRealHeight(40),
             Width = Application.GetRealWidth(50),
             Height = Application.GetRealHeight(17),
             Text = "/10",
@@ -159,7 +143,6 @@
             devfLayout.Height = Application.GetRealHeight(92 + (50 * i));
             devfLayout.AddChidren(priequipmentBtn);
             devfLayout.AddChidren(deviceNameBtn);
-            devfLayout.AddChidren(versionBtn);
             devfLayout.AddChidren(geBtn);
             geBtn.Width = geBtn.GetTextWidth();
             devfLayout.AddChidren(sumBtn);

--
Gitblit v1.8.0