From d87400af518ebc9274f4447f06476959c3aa5102 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 14 七月 2020 16:29:42 +0800
Subject: [PATCH] Merge branch 'dev-tzy' into dev-2020xm

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs |   68 +++++++++++++++++++++++++++------
 1 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
old mode 100755
new mode 100644
index 1bd57b2..87fda05
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
@@ -14,7 +14,6 @@
     public class DeviceMacInfoEditorForm : EditorCommonForm
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
-
         /// <summary>
         /// 璁惧瀵硅薄
         /// </summary>
@@ -102,13 +101,13 @@
             {
                 //绠�绾﹂潰鏉块殢渚夸竴涓洖璺潵鑾峰彇璁惧淇℃伅
                 var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 62);
-                if (dev != null)
-                {
-                    var key = new ZigBee.Device.Panel();
-                    key.DeviceAddr = deviceMac;
-                    key.CurrentGateWayId = dev.CurrentGateWayId;
-                    InitBindInfo(key);
-                }
+                if (dev != null)
+                {
+                    var key = new ZigBee.Device.Panel();
+                    key.DeviceAddr = deviceMac;
+                    key.CurrentGateWayId = dev.CurrentGateWayId;
+                    InitBindInfo(key);
+                }
             }
         }
 
@@ -297,7 +296,7 @@
             }
             else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
             {
-                //娣诲姞銆愮粦瀹氱洰鏍囥�戣(绠�绾︾幆澧冮潰鏉跨敤) 
+                //娣诲姞銆愮粦瀹氱洰鏍囥�戣(绠�绾︾幆澧冮潰鏉跨敤)
                 this.AddSimplePanelSettionRow();
             }
             else
@@ -1212,9 +1211,9 @@
                 foreach (var bDev in bindList)
                 {
                     var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint);
-                    if (device == null)
-                    {
-                        continue;
+                    if (device == null)
+                    {
+                        continue;
                     }
                     if (device.Type == DeviceType.TemperatureSensor)
                     {
@@ -1547,7 +1546,24 @@
                     //鍒犻櫎鎸囧畾璁惧
                     this.DoDeleteDevice();
                 });
-            });
+            });
+
+            //鍚屾
+            deviceMenu = Language.StringByID(R.MyInternationalizationString.Synchronization);
+            if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(listNewDevice[0]))
+            {
+                frame.AddRowMenu(deviceMenu, "", "Item/SynchronizationSelected.png", () =>
+                {
+                    //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹�,姝ゅ姛鑳芥棤鏁�
+                    if (Common.Config.Instance.Home.IsVirtually == true)
+                    {
+                        return;
+                    }
+
+                    //鍚屾鎸囧畾璁惧
+                    this.SynchronizationDevice();
+                });
+            }
 
             //鍚屾
             deviceMenu = Language.StringByID(R.MyInternationalizationString.Synchronization);
@@ -1592,6 +1608,32 @@
                     this.CloseForm();
                 });
             });
+        }
+
+        /// <summary>
+        /// 鍚屾鎸囧畾璁惧
+        /// </summary>
+        private void SynchronizationDevice()
+        {
+            HdlThreadLogic.Current.RunThread(async () =>
+            {
+                //鎵撳紑杩涘害鏉�
+                this.ShowProgressBar();
+
+                //鍚屾璁惧
+                bool result = await Common.LocalDevice.Current.SynchronizationDevice(listNewDevice);
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar();
+                if (result == false)
+                {
+                    return;
+                }
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鍏抽棴鐣岄潰
+                    this.CloseForm();
+                });
+            });
         }
 
         /// <summary>

--
Gitblit v1.8.0