From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 16 四月 2020 17:10:57 +0800
Subject: [PATCH] 请合并代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs |  116 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 93 insertions(+), 23 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index 2296aba..0dc5e74 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -22,6 +22,10 @@
         /// </summary>
         private VerticalListRefreshControl listView = null;
         /// <summary>
+        /// 鍓嶄竴娆℃樉绀哄嚭宸︽粦鑿滃崟鐨凴owLayout
+        /// </summary>
+        private RowLayoutControl oldShowRightMuneRow = null;
+        /// <summary>
         /// 琛屾帶浠剁殑淇℃伅(Keys锛歁ac鍦板潃)
         /// </summary>
         private Dictionary<string, DeviceObjRowInfo> dicRowInfo = new Dictionary<string, DeviceObjRowInfo>();
@@ -43,6 +47,8 @@
         /// </summary>
         public void ShowForm()
         {
+            this.ScrollEnabled = false;
+
             //璁剧疆鏍囬淇℃伅
             base.SetTitleText(Language.StringByID(R.MyInternationalizationString.DeviceManagement));
 
@@ -152,6 +158,8 @@
             //鑾峰彇璁惧鍒楄〃
             string gwID = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
             var listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(gwID);
+            var listSpecialOta = Common.LocalDevice.Current.GetSpecialOtaDevice(gwID);
+            listDevice.AddRange(listSpecialOta);
 
             this.dicRowInfo.Clear();
 
@@ -210,6 +218,7 @@
 
             //鎺т欢
             var rowMenu = new DeviceObjectControl(deviceMac, listView.rowSpace / 2);
+            rowMenu.MainKeys = deviceMac;
             frameTable.AddChidren(rowMenu);
             rowMenu.InitControl();
             rowInfo.MenuRow = rowMenu;
@@ -227,16 +236,11 @@
 
             //妫�娴嬭澶囨槸鍚︽嫢鏈夊畾浣嶇殑鍔熻兘
             var listdevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
-            if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(listdevice[0]) == true)
+            if (listdevice.Count > 0 && Common.LocalDevice.Current.DeviceIsCanFixedPosition(listdevice[0]) == true)
             {
                 //瀹氫綅
-                var btnPosition = new NormalViewControl(Application.GetRealWidth(184), rowMenu.Height, false);
+                var btnPosition = rowMenu.AddEditorControl(false);
                 btnPosition.TextID = R.MyInternationalizationString.uFixedPosition;
-                btnPosition.TextAlignment = TextAlignment.Center;
-                btnPosition.TextSize = 12;
-                btnPosition.TextColor = UserCenterColor.Current.White;
-                btnPosition.BackgroundColor = 0xff4a4a4a;
-                rowMenu.AddRightView(btnPosition);
                 btnPosition.ButtonClickEvent += (sender, e) =>
                 {
                     //瀹氫綅
@@ -266,11 +270,30 @@
 
             rowMenu.frameTable.ButtonClickEvent += (sender, e) =>
             {
+                //闅愯棌鑿滃崟
+                rowMenu.HideMenu();
+                //寮哄埗璺宠浆鐪熷疄璁惧鐣岄潰
+                if (UserCenterResourse.HideOption.GotoRealDeviceForm == 1)
+                {
+                    var form2 = new DeviceAddSuccessForm();
+                    form2.AddForm(deviceMac);
+                    return;
+                }
                 btnNew.Visible = false;
                 var form = new DeviceMacInfoEditorForm();
                 form.AddForm(deviceMac);
                 //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃
                 this.nowActionDeviceMac = deviceMac;
+            };
+            //宸︽粦鑿滃崟浜嬩欢
+            rowMenu.OpenMenuAction += () =>
+            {
+                if (this.oldShowRightMuneRow != null && this.oldShowRightMuneRow.MainKeys != rowMenu.MainKeys)
+                {
+                    //宸︽粦鑿滃崟鍙兘婊戜竴涓�
+                    this.oldShowRightMuneRow.HideMenu();
+                }
+                this.oldShowRightMuneRow = rowMenu;
             };
         }
 
@@ -327,6 +350,7 @@
 
             //琛屾帶浠�
             var rowDevice = new DeviceRoomControl(device, frame.rowSpace / 2);
+            rowDevice.MainKeys = LocalDevice.Current.GetDeviceMainKeys(device);
             frame.AddChidren(rowDevice);
             rowDevice.frameTable.LeftOffset = Application.GetRealWidth(173) - ControlCommonResourse.XXLeft;
             rowDevice.InitControl();
@@ -345,13 +369,8 @@
             if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(device) == true)
             {
                 //瀹氫綅
-                var btnPosition = new NormalViewControl(Application.GetRealWidth(184), rowDevice.Height, false);
+                var btnPosition = rowDevice.AddEditorControl(false);
                 btnPosition.TextID = R.MyInternationalizationString.uFixedPosition;
-                btnPosition.TextAlignment = TextAlignment.Center;
-                btnPosition.TextSize = 12;
-                btnPosition.TextColor = UserCenterColor.Current.White;
-                btnPosition.BackgroundColor = 0xff4a4a4a;
-                rowDevice.AddRightView(btnPosition);
                 btnPosition.ButtonClickEvent += (sender, e) =>
                 {
                     //瀹氫綅
@@ -361,10 +380,22 @@
 
             rowDevice.frameTable.ButtonClickEvent += (sender, e) =>
             {
+                //闅愯棌鑿滃崟
+                rowDevice.HideMenu();
                 //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃
                 this.nowActionDeviceMac = device.DeviceAddr;
                 //鏄剧ず璁惧鍔熻兘閰嶇疆鐣岄潰
                 this.ShowDeviceFunctionSettionForm(device, deviceEnumInfo);
+            };
+            //宸︽粦鑿滃崟浜嬩欢
+            rowDevice.OpenMenuAction += () =>
+            {
+                if (this.oldShowRightMuneRow != null && this.oldShowRightMuneRow.MainKeys != rowDevice.MainKeys)
+                {
+                    //宸︽粦鑿滃崟鍙兘婊戜竴涓�
+                    this.oldShowRightMuneRow.HideMenu();
+                }
+                this.oldShowRightMuneRow = rowDevice;
             };
         }
 
@@ -407,6 +438,44 @@
                 var form = new DeviceAirConditioner.IndoorUnitSettionForm();
                 form.AddForm((AC)device);
             }
+            //鐜闈㈡澘
+            else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment)
+            {
+                var form = new DeviceFunctionSettionForm();
+                form.AddForm(device, true);
+            }
+            //鏂伴闈㈡澘
+            else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
+            {
+                //鏂规偊鏂伴闈㈡澘鐨勬寜閿厤缃�
+                var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm();
+                form.AddForm(device);
+            }
+            //鏂规偊闈㈡澘
+            else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueTwo
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFour
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEight)
+            {
+                //骞叉帴鐐�
+                if (device.Type == DeviceType.OnOffSwitch)
+                {
+                    //鏂规偊闈㈡澘鐨勬寜閿厤缃�
+                    var form = new DevicePanel.PanelFangyueButtonSettionForm();
+                    form.AddForm(device);
+                }
+                //缁х數鍣�
+                else if (device.Type == DeviceType.OnOffOutput)
+                {
+                    //鏂规偊闈㈡澘鐨勫姛鑳介厤缃�
+                    var form = new DevicePanel.PanelFangyueFunctionSettionForm();
+                    form.AddForm(device);
+                }
+                else
+                {
+                    var form = new DeviceFunctionSettionForm();
+                    form.AddForm(device, true);
+                }
+            }
             //闈㈡澘璁惧
             else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘)
             {
@@ -439,12 +508,6 @@
                         var form = new DeviceFunctionSettionForm();
                         form.AddForm(device, true);
                     }
-                }
-                //娓╂箍搴�
-                else if (device.Type == DeviceType.TemperatureSensor)
-                {
-                    var form = new DeviceFunctionSettionForm();
-                    form.AddForm(device, true);
                 }
                 else
                 {
@@ -843,8 +906,14 @@
                 var localDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr);
                 if (localDevice.Count == 0)
                 {
-                    //鍏ョ綉涔嬪悗锛屽張鎶婂畠鍒犱簡
-                    return;
+                    //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶�
+                    var ota = Common.LocalDevice.Current.GetOTADevice(deviceAddr);
+                    if (ota == null)
+                    {
+                        //鍏ョ綉涔嬪悗锛屽張鎶婂畠鍒犱簡
+                        return;
+                    }
+                    localDevice.Add(ota);
                 }
                 var rowNewInfo = new DeviceObjRowInfo();
                 rowNewInfo.DeviceMac = deviceAddr;
@@ -904,8 +973,9 @@
             if (this.nowActionDeviceMac != null)
             {
                 var rowInfo = this.dicRowInfo[nowActionDeviceMac];
-                //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎
-                if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0)
+                //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎 2020.01.13鍙樻洿:杩藉姞Ota璁惧鐨勫垽鏂�
+                if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0
+                    && Common.LocalDevice.Current.GetOTADevice(nowActionDeviceMac) == null)
                 {
                     //绉婚櫎鎺т欢
                     rowInfo.dicDetailRow = null;

--
Gitblit v1.8.0