From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs |  134 ++++++++++++++++++++++++++++----------------
 1 files changed, 84 insertions(+), 50 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs
index 46ead4f..f65d1cc 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs
@@ -17,7 +17,7 @@
         /// <summary>
         /// 鍒楄〃鎺т欢
         /// </summary>
-        private VerticalListControl listview = null;
+        private FrameListControl listview = null;
         /// <summary>
         /// 褰撳墠閫夋嫨鐨勮澶�
         /// </summary>
@@ -29,7 +29,7 @@
         /// <summary>
         /// 璁惧澶囨敞鐨勬帶浠�
         /// </summary>
-        private FrameCaptionInputControl btnDeviceName = null;
+        private FrameCaptionInputControl frameDeviceName = null;
         /// <summary>
         /// 璁惧鐨勬煇涓�鍥炶矾
         /// </summary>
@@ -80,21 +80,25 @@
             //娓呯┖bodyFrame
             this.ClearBodyFrame();
 
+            var listBackControl = new VerticalFrameControl();
+            listBackControl.Height = bodyFrameLayout.Height;
+            bodyFrameLayout.AddChidren(listBackControl);
+
             //鍒濆鍖栨甯�
             this.tableContr = new InformationEditorControl();
-            this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 562, 1175);
+            this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1175);
 
             //鍒濆鍖栬澶囧洖璺浘鏍�
-            this.InitDeviceEpointIcon();
+            this.InitDeviceEpointIcon(listBackControl);
 
             //淇濆瓨
             var btnFinish = new BottomClickButton();
             btnFinish.TextID = R.MyInternationalizationString.uSave;
             bodyFrameLayout.AddChidren(btnFinish);
-            btnFinish.ButtonClickEvent += async (sender, e) =>
+            btnFinish.ButtonClickEvent += (sender, e) =>
             {
                 //璁板綍璧峰綋鍓嶆鍦ㄦ搷浣滅殑鍥炶矾鍚嶅瓧
-                dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim();
+                dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = frameDeviceName.Text.Trim();
                 //寮�鍚繘搴︽潯
                 this.ShowProgressBar();
                 foreach (var epoint in dicDeviceSaveName.Keys)
@@ -110,7 +114,7 @@
                     if (oldName != newName)
                     {
                         //璁惧鍚嶇О淇敼
-                        var result = await Common.LocalDevice.Current.ReName(device, newName);
+                        var result = Common.LocalDevice.Current.ReName(device, newName);
                         if (result == false)
                         {
                             //鍏抽棴
@@ -123,12 +127,17 @@
                 //鍏抽棴鑷韩
                 this.CloseForm();
             };
+            //濡傛灉褰撳墠鏄睍绀烘ā鏉�,鍒欎笉鑳界紪杈�
+            if (Common.Config.Instance.Home.IsShowTemplate == true)
+            {
+                btnFinish.CanClick = false;
+            }
         }
 
         /// <summary>
         /// 鍒濆鍖栬彍鍗曡
         /// </summary>
-        private async void InitMenuRow()
+        private void InitMenuRow()
         {
             this.listview.RemoveAll();
 
@@ -140,31 +149,36 @@
                 nameValue = dicDeviceSaveName[nowSelectDevice.DeviceEpoint];
             }
 
-            this.btnDeviceName = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2);
-            listview.AddChidren(btnDeviceName);
-            btnDeviceName.InitControl();
-            btnDeviceName.AddBottomLine();
-            btnDeviceName.txtInput.FinishInputEvent += async () =>
+            this.frameDeviceName = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2);
+            this.frameDeviceName.txtInput.MaxByte = 48;//闄愬埗鍙兘杈撳叆48涓瓧鑺�
+            listview.AddChidren(frameDeviceName);
+            frameDeviceName.InitControl();
+            frameDeviceName.AddBottomLine();
+            //濡傛灉褰撳墠鏄睍绀烘ā鏉�,鍒欎笉鑳界紪杈�
+            if (Common.Config.Instance.Home.IsShowTemplate == false)
             {
-                string oldName = Common.LocalDevice.Current.GetDeviceEpointName(nowSelectDevice);
-                if (btnDeviceName.Text.Trim() == string.Empty)
+                frameDeviceName.txtInput.FinishInputEvent += () =>
                 {
-                    //灏嗗悕瀛楄繕鍘�
-                    btnDeviceName.Text = oldName;
-                }
-                if (oldName != btnDeviceName.Text.Trim())
-                {
-                    //璁惧鍚嶇О淇敼
-                    var result = await Common.LocalDevice.Current.ReName(nowSelectDevice, btnDeviceName.Text.Trim());
-                    if (result == false)
+                    string oldName = Common.LocalDevice.Current.GetDeviceEpointName(nowSelectDevice);
+                    if (frameDeviceName.Text.Trim() == string.Empty)
                     {
-                        return;
+                        //灏嗗悕瀛楄繕鍘�
+                        frameDeviceName.Text = oldName;
                     }
-                    //骞叉帴鐐瑰娉ㄤ慨鏀规垚鍔�!
-                    string msg = Language.StringByID(R.MyInternationalizationString.uDryContactReNoteSuccess);
-                    this.ShowMassage(ShowMsgType.Tip, msg);
-                }
-            };
+                    if (oldName != frameDeviceName.Text.Trim())
+                    {
+                        //璁惧鍚嶇О淇敼
+                        var result = Common.LocalDevice.Current.ReName(nowSelectDevice, frameDeviceName.Text.Trim());
+                        if (result == false)
+                        {
+                            return;
+                        }
+                        //骞叉帴鐐瑰娉ㄤ慨鏀规垚鍔�!
+                        string msg = Language.StringByID(R.MyInternationalizationString.uDryContactReNoteSuccess);
+                        this.ShowMassage(ShowMsgType.Tip, msg);
+                    }
+                };
+            }
 
             //鎵�灞炲尯鍩�
             var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
@@ -186,13 +200,15 @@
             if (isHdlDevice == true)
             {
                 //濡傛灉鏄�3璺户鐢靛櫒鎴栬��1璺皟鍏夊櫒,骞朵笖鏄涓冨洖璺殑鏃跺��,瀹冨ソ鍍忓彲浠ユ敼鍙樼被鍨�
+                //濡傛灉鏄�7璺共鎺ョ偣杈撳叆杈撳嚭妯″潡,骞朵笖鏄涓冨洖璺殑鏃跺��,瀹冨ソ鍍忓彲浠ユ敼鍙樼被鍨�
                 if ((deviceEnumInfo.ConcreteType == DeviceConcreteType.Relay_ThreeLoad && nowSelectDevice.DeviceEpoint == 10)
-                    || (deviceEnumInfo.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad && nowSelectDevice.DeviceEpoint == 7))
+                    || (deviceEnumInfo.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad && nowSelectDevice.DeviceEpoint == 7)
+                    || (deviceEnumInfo.ConcreteType == DeviceConcreteType.Relay_SevenLoadInOutPutDryContact && nowSelectDevice.DeviceEpoint == 7))
                 {
                     //杩欓噷鍏堝幓鑾峰彇瀹冪殑骞叉帴鐐圭被鍨�
                     this.ShowProgressBar();
                     //鑾峰彇绗竷鍥炶矾鐨勯厤缃俊鎭�
-                    listRelayInfo7 = await HdlDevicePanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice);
+                    listRelayInfo7 = HdlDevicePanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice);
                     if (listRelayInfo7 == null)
                     {
                         //鍏抽棴杩涘害鏉�
@@ -211,7 +227,7 @@
             //娣诲姞鑳屽厜鐏
             this.AddBackLightRow();
             //鍒濆鍖栨甯冨畬鎴�
-            tableContr.FinishInitControl(bodyFrameLayout, this.listview);
+            tableContr.FinishInitControl();
         }
 
         #endregion
@@ -224,7 +240,8 @@
         private void InitTopRightMenu()
         {
             //妫�娴嬫鍥炶矾鏄惁鎷ユ湁瀹氫綅鍔熻兘
-            if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(nowSelectDevice) == false)
+            if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(nowSelectDevice) == false
+                || Common.Config.Instance.Home.IsShowTemplate == true)
             {
                 return;
             }
@@ -320,8 +337,8 @@
                     var title = Language.StringByID(R.MyInternationalizationString.uSelectDryContactFunction);
 
                     var form = new BottomItemSelectForm();
-                    form.AddForm(title, listText, nowSelectNo);
-                    form.FinishSelectEvent += async (selectNo) =>
+                    form.AddForm(title, listText, null, nowSelectNo);
+                    form.FinishSelectEvent += (selectNo) =>
                     {
                         if (selectNo == nowSelectNo)
                         {
@@ -335,7 +352,7 @@
                             //閫夋嫨鐨勬槸浼犳劅鍣ㄨ緭鍏�
                             value = 65535;
                         }
-                        var result = await HdlDevicePanelLogic.Current.EditorDryContactThirdFunction((Panel)nowSelectDevice, value);
+                        var result = HdlDevicePanelLogic.Current.EditorDryContactThirdFunction((Panel)nowSelectDevice, value);
                         if (result == true)
                         {
                             //閲嶆柊鍒濆鍖栬彍鍗曡,闅愯棌鎴栬�呭紑鏀剧粦瀹氱洰鏍囪彍鍗�
@@ -343,6 +360,11 @@
                         }
                     };
                 };
+                //濡傛灉褰撳墠鏄睍绀烘ā鏉�,鍒欎笉鑳界紪杈�
+                if (Common.Config.Instance.Home.IsShowTemplate == true)
+                {
+                    btnFunction.CanClick = false;
+                }
             }
         }
 
@@ -404,8 +426,11 @@
             var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr);
             var myType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
 
+            //娆ф爣2璺�5A娌℃湁鑳屽厜鐏�
             if (myType.ConcreteType == DeviceConcreteType.Relay_ThreeLoad
-                || myType.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad)
+                || myType.ConcreteType == DeviceConcreteType.DimmableLight_OneLoad
+                || myType.ConcreteType == DeviceConcreteType.Relay_NationalThreeLoadTenA
+                || myType.ConcreteType == DeviceConcreteType.Relay_SevenLoadInOutPutDryContact)
             {
                 //鑳屽厜鐏�
                 string caption = Language.StringByID(R.MyInternationalizationString.uBackLight);
@@ -418,8 +443,19 @@
                 btnLight.AddRightArrow();
                 btnLight.ButtonClickEvent += (sender, e) =>
                 {
-                    var form = new DeviceRelay.RelayThreeLoadBackLightSettionForm();
-                    form.AddForm(deviceObj.DeviceAddr);
+                    if (myType.ConcreteType == DeviceConcreteType.Relay_NationalThreeLoadTenA
+                    || myType.ConcreteType == DeviceConcreteType.Relay_SevenLoadInOutPutDryContact)
+                    {
+                        //鍥芥爣3璺�10A缁х數鍣ㄥ皬妯″潡 鎴栬�� 7璺共鎺ョ偣杈撳叆杈撳嚭妯″潡
+                        var form = new DeviceRelay.RelayNationalBackLightSettionForm();
+                        form.AddForm(deviceObj.DeviceAddr);
+                    }
+                    else
+                    {
+                        //涓夎矾缁х數鍣�,鎴栬�呬竴璺皟鍏夊櫒
+                        var form = new DeviceRelay.RelayThreeLoadBackLightSettionForm();
+                        form.AddForm(deviceObj.DeviceAddr);
+                    }
                 };
             }
         }
@@ -431,7 +467,7 @@
         /// <summary>
         /// 鍒濆鍖栬澶囧洖璺浘鏍�
         /// </summary>
-        private void InitDeviceEpointIcon()
+        private void InitDeviceEpointIcon(VerticalFrameControl listBackControl)
         {
             //鑾峰彇鎸夌粍鍒嗛厤鐨勮澶�
             var listIcon = this.GetAllDeviceGroup();
@@ -442,9 +478,7 @@
             frameBorder.Width = Application.GetRealWidth(887);
             frameBorder.Height = Application.GetRealHeight(423);
             frameBorder.Radius = (uint)Application.GetRealHeight(6);
-            frameBorder.BorderWidth = 1;
-            frameBorder.BorderColor = 0xffd0d0d0;
-            bodyFrameLayout.AddChidren(frameBorder);
+            listBackControl.frameTable.AddChidren(frameBorder);
 
             var frameBack = new FrameLayout();
             frameBack.Height = frameBorder.Height;
@@ -454,7 +488,7 @@
                 //闇�瑕佹粦鍔ㄦ帶浠�
                 var listControl = new VerticalScrolViewLayout();
                 listControl.Height = frameBorder.Height;
-                bodyFrameLayout.AddChidren(listControl);
+                listBackControl.frameTable.AddChidren(listControl);
 
                 listControl.AddChidren(frameBack);
             }
@@ -468,8 +502,8 @@
             for (int i = 0; i < listIcon.Count; i++)
             {
                 var frame = new FrameLayout();
-                frame.Width = Application.GetMinRealAverage(887);
-                frame.Height = Application.GetMinRealAverage(124);
+                frame.Width = this.GetPictrueRealSize(887);
+                frame.Height = this.GetPictrueRealSize(124);
                 frameBack.AddChidren(frame);
                 //鍒濆鍖栦竴琛岃澶囧浘鏍�
                 this.InitDeviceIconFrame(frame, listIcon[i], ref index);
@@ -480,14 +514,14 @@
                 }
                 else
                 {
-                    frame.Y = Application.GetMinRealAverage(58) + (frameBack.ChildrenCount - 1) * (frame.Height + Application.GetMinRealAverage(60));
+                    frame.Y = this.GetPictrueRealSize(58) + (frameBack.ChildrenCount - 1) * (frame.Height + this.GetPictrueRealSize(60));
                 }
             }
 
             if (listIcon.Count > 2)
             {
                 //璁$畻鐪熷疄楂樺害
-                int realHeight = Application.GetMinRealAverage(58 + 58) + (frameBack.ChildrenCount - 1) * Application.GetMinRealAverage(124 + 60);
+                int realHeight = this.GetPictrueRealSize(58 + 58) + (frameBack.ChildrenCount - 1) * this.GetPictrueRealSize(124 + 60);
                 if (realHeight > frameBack.Height)
                 {
                     //鍙樻洿楂樺害
@@ -507,7 +541,7 @@
         {
             NormalViewControl btnTemp = null;
             //闂磋窛
-            int space = Application.GetMinRealAverage(84);
+            int space = this.GetPictrueRealSize(84);
             int defultXX = (frame.Width - frame.Height * listDevice.Count - (listDevice.Count - 1) * space) / 2;
             for (int i = 0; i < listDevice.Count; i++)
             {
@@ -618,7 +652,7 @@
                 nowSelectControl.TextSize = 13;
                 nowSelectControl.TextColor = UserCenterColor.Current.TextGrayColor3;
                 //璁板綍瀹冪殑鍚嶅瓧
-                dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim();
+                dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = frameDeviceName.Text.Trim();
             }
             //閫夋嫨鐘舵��
             nowContr.BorderColor = 0xfffb744a;

--
Gitblit v1.8.0