From e96e11d6f8b965ea522c983e040d41e3b9ef105a Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 18 五月 2020 21:33:19 +0800
Subject: [PATCH] 2020-05-18-4

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs |  133 +++++++++++---------------------------------
 1 files changed, 34 insertions(+), 99 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
index 59fbecb..bab6b42 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
@@ -264,8 +264,8 @@
                     //娣诲姞銆愭寜閿缃�戣(闈㈡澘涓撶敤)
                     this.AddPanelSettionRow();
                 }
-                //鏂规偊鏂伴闈㈡澘娌℃湁鍔熻兘璁剧疆
-                if (deviceEnumInfo.ConcreteType != DeviceConcreteType.ButtonPanel_FangyueFreshAir)
+                //妫�娴嬭兘鍚︽樉绀哄姛鑳借缃殑鑿滃崟
+                if (this.CheckCanShowFunctionSettionRow() == true)
                 {
                     //娣诲姞銆愬姛鑳借缃�戣
                     this.AddFunctionSettionRow();
@@ -682,7 +682,11 @@
             //鍙湁鍥炶矾鏁板ぇ浜�1鎵嶈兘鏈夎繖涓彍鍗�
             if (Common.LocalDevice.Current.GetDevicesCountByMac(listNewDevice[0].DeviceAddr) == 1)
             {
-                return;
+                //瑕佹眰鏂伴灏忔ā鍧楃殑鏂伴鏈夊姛鑳借缃�
+                if (deviceEnumInfo.ConcreteType != DeviceConcreteType.Relay_FangyueFreshAirModul)
+                {
+                    return;
+                }
             }
             if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment
                 || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
@@ -897,108 +901,23 @@
         /// </summary>
         private void AddAirSwitchFunctionTypeRow()
         {
-            if (this.deviceEnumInfo.BeloneType != DeviceBeloneType.A鏅鸿兘绌哄紑)
+            //2020.04.28鍙樻洿:鏈変釜鍒澶囧畠闄や簡缁х數鍣ㄥ洖璺紝浠�涔堥兘娌℃湁浜�,
+            //杩欎釜鏃跺�欎篃瑕佺幇瀹炲嚭鏉�
+            if (this.listNewDevice.Count != 1)
             {
-                //涓嶆槸绌烘皵寮�鍏�
                 return;
             }
-
-            //鍔熻兘绫诲瀷
-            string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType);
-            var DfunctionType = this.listNewDevice[0].DfunctionType;
-
-            //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
-            int nowSelectNo = 1;
-            string strType = string.Empty;
-            if (DfunctionType == DeviceFunctionType.A鐏厜)
+            if (this.listNewDevice[0].Type != DeviceType.OnOffOutput
+                && this.listNewDevice[0].Type != DeviceType.AirSwitch)
             {
-                strType = Language.StringByID(R.MyInternationalizationString.uLight);
-                nowSelectNo = 1;
+                return;
             }
-            else if (DfunctionType == DeviceFunctionType.A寮�鍏�)
-            {
-                strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
-                nowSelectNo = 0;
-            }
-            else if (DfunctionType == DeviceFunctionType.A鎻掑骇)
-            {
-                strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
-                nowSelectNo = 2;
-            }
-
-            var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2);
-            btnFunction.UseClickStatu = true;
-            listview.AddChidren(btnFunction);
-            btnFunction.InitControl();
+            //鑷畾涔夊姛鑳界被鍨嬫帶浠�
+            var rowFunction = new DeviceFunctionTypeRowControl(this.listNewDevice[0], listview.rowSpace / 2);
+            listview.AddChidren(rowFunction);
+            rowFunction.InitControl();
             //搴曠嚎
-            btnFunction.AddBottomLine();
-            //鍙崇澶�
-            btnFunction.AddRightArrow();
-            btnFunction.ButtonClickEvent += (sender, e) =>
-            {
-                //鏄剧ず鍒楄〃
-                var listText = new List<string>();
-                listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//寮�鍏�
-                listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//鐏厜
-                listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//鎻掑骇
-                //鏍囬:閫夋嫨鍔熻兘绫诲瀷
-                var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType);
-
-                var form = new BottomItemSelectForm();
-                form.CancelCallEvent = true;//鍏佽鍙栨秷
-                form.AddForm(title, listText, nowSelectNo);
-                form.FinishSelectEvent += (selectNo) =>
-                {
-                    if (selectNo == -1)
-                    {
-                        //閫夋嫨鍙栨秷
-                        btnFunction.Text = string.Empty;
-                    }
-                    else
-                    {
-                        btnFunction.Text = listText[selectNo];
-                    }
-                    nowSelectNo = selectNo;
-                    //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨�
-                    if (selectNo == 0)
-                    {
-                        this.listNewDevice[0].DfunctionType = DeviceFunctionType.A寮�鍏�;
-                        if (this.listNewDevice[0].IsCustomizeImage == false)
-                        {
-                            //閲嶆柊璁剧疆鍥剧墖
-                            this.listNewDevice[0].IconPath = "Device/Switch.png";
-                        }
-                    }
-                    else if (selectNo == 1)
-                    {
-                        this.listNewDevice[0].DfunctionType = DeviceFunctionType.A鐏厜;
-                        if (this.listNewDevice[0].IsCustomizeImage == false)
-                        {
-                            //閲嶆柊璁剧疆鍥剧墖
-                            this.listNewDevice[0].IconPath = "Device/Light.png";
-                        }
-                    }
-                    else if (selectNo == 2)
-                    {
-                        this.listNewDevice[0].DfunctionType = DeviceFunctionType.A鎻掑骇;
-                        if (this.listNewDevice[0].IsCustomizeImage == false)
-                        {
-                            //閲嶆柊璁剧疆鍥剧墖
-                            this.listNewDevice[0].IconPath = "Device/Socket1.png";
-                        }
-                    }
-                    else
-                    {
-                        this.listNewDevice[0].DfunctionType = DeviceFunctionType.A鏈畾涔�;
-                        if (this.listNewDevice[0].IsCustomizeImage == false)
-                        {
-                            //閲嶆柊璁剧疆鍥剧墖
-                            this.listNewDevice[0].IconPath = "Device/Switch.png";
-                        }
-                    }
-                    this.listNewDevice[0].ReSave();
-                };
-            };
+            rowFunction.AddBottomLine();
         }
 
         #endregion
@@ -1370,6 +1289,22 @@
             });
         }
 
+        /// <summary>
+        /// 妫�娴嬭兘鍚︽樉绀哄姛鑳借缃殑鑿滃崟
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckCanShowFunctionSettionRow()
+        {
+            //鏂规偊鏂伴闈㈡澘娌℃湁鍔熻兘璁剧疆
+            if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FourButtonScene
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_TwoButtonCurtain)
+            {
+                return false;
+            }
+            return true;
+        }
+
         #endregion
     }
 }

--
Gitblit v1.8.0