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 |  100 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 80 insertions(+), 20 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index cf5ecc4..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>();
@@ -214,6 +218,7 @@
 
             //鎺т欢
             var rowMenu = new DeviceObjectControl(deviceMac, listView.rowSpace / 2);
+            rowMenu.MainKeys = deviceMac;
             frameTable.AddChidren(rowMenu);
             rowMenu.InitControl();
             rowInfo.MenuRow = rowMenu;
@@ -234,13 +239,8 @@
             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) =>
                 {
                     //瀹氫綅
@@ -270,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;
             };
         }
 
@@ -331,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();
@@ -349,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) =>
                 {
                     //瀹氫綅
@@ -365,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;
             };
         }
 
@@ -411,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鎸夐敭闈㈡澘)
             {
@@ -443,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
                 {
@@ -914,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