From 31497bb69602433d94c8a28ea01c3ee3c7cc8576 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 24 十月 2019 14:32:30 +0800
Subject: [PATCH] 完全合并了Wjc,Xm 的 代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs |  158 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 117 insertions(+), 41 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index 6d2082c..f3149a5 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -1,4 +1,5 @@
-锘縰sing System;
+锘縰sing Shared.Common;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using ZigBee.Device;
@@ -213,7 +214,10 @@
             rowMenu.InitControl();
             rowInfo.MenuRow = rowMenu;
             //鍚戝彸鍥炬爣
-            var btnRight = rowMenu.frameTable.AddRightArrow();
+            var btnRight = rowMenu.frameTable.AddMostRightEmptyIcon(58, 58);
+            rowMenu.frameTable.ChangedChidrenBindMode(btnRight, ChidrenBindMode.NotBind);
+            btnRight.UseClickStatu = false;
+            btnRight.UnSelectedImagePath = "Item/Next.png";
             btnRight.SelectedImagePath = "Item/Down.png";
 
             //鎻愮ず鏂扮増鏈�
@@ -241,22 +245,21 @@
                 };
             }
 
+            //灞曞紑,鎶樺彔
+            btnRight.ButtonClickEvent += (sender, e) =>
+            {
+                btnRight.IsSelected = !btnRight.IsSelected;
+                //灞曞紑鎴栬�呮姌鍙犳槑缁嗗垪琛�
+                this.ShowDetailList(deviceMac, btnRight.IsSelected);
+            };
+
             rowMenu.frameTable.ButtonClickEvent += (sender, e) =>
             {
-                //澶氬洖璺殑鎯呭喌涓嬶紝鎵嶄細灞曞紑
-                if (Common.LocalDevice.Current.GetDevicesByMac(deviceMac).Count == 1)
-                {
-                    var form = new DeviceMacInfoEditorForm();
-                    form.AddForm(deviceMac);
-                    //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃
-                    this.nowActionDeviceMac = deviceMac;
-                }
-                else
-                {
-                    btnRight.IsSelected = !btnRight.IsSelected;
-                    //灞曞紑鎴栬�呮姌鍙犳槑缁嗗垪琛�
-                    this.ShowDetailList(deviceMac, btnRight.IsSelected);
-                }
+                btnNew.Visible = false;
+                var form = new DeviceMacInfoEditorForm();
+                form.AddForm(deviceMac);
+                //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃
+                this.nowActionDeviceMac = deviceMac;
             };
         }
 
@@ -284,10 +287,12 @@
                 //鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢
                 if (rowInfo.frameTable.ChildrenCount == 1)
                 {
+                    //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑
+                    var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
                     foreach (CommonDevice info in listDevice)
                     {
                         //鍔犺浇瀹冪殑鍒楄〃
-                        this.AddDeviceDetailRow(rowInfo.frameTable, info);
+                        this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
                     }
                 }
             }
@@ -300,7 +305,8 @@
         /// </summary>
         /// <param name="frame">瀹瑰櫒</param>
         /// <param name="device"></param>
-        private void AddDeviceDetailRow(FrameListControl frame, CommonDevice device)
+        /// <param name="deviceEnumInfo"></param>
+        private void AddDeviceDetailRow(FrameListControl frame, CommonDevice device, DeviceEnumInfo deviceEnumInfo)
         {
             var rowInfo = this.dicRowInfo[device.DeviceAddr];
             if (rowInfo.dicDetailRow == null)
@@ -344,11 +350,82 @@
 
             rowDevice.frameTable.ButtonClickEvent += (sender, e) =>
             {
-                var form = new DeviceMacInfoEditorForm();
-                form.AddForm(device.DeviceAddr);
                 //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃
                 this.nowActionDeviceMac = device.DeviceAddr;
+                //鏄剧ず璁惧鍔熻兘閰嶇疆鐣岄潰
+                this.ShowDeviceFunctionSettionForm(device, deviceEnumInfo);
             };
+        }
+
+        /// <summary>
+        /// 鏄剧ず璁惧鍔熻兘閰嶇疆鐣岄潰
+        /// </summary>
+        /// <param name="device"></param>
+        /// <param name="deviceEnumInfo"></param>
+        private void ShowDeviceFunctionSettionForm(CommonDevice device, DeviceEnumInfo deviceEnumInfo)
+        {
+            //鏅鸿兘闂ㄩ攣
+            if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣)
+            {
+                var form = new DeviceMacInfoEditorForm();
+                form.AddForm(device.DeviceAddr);
+            }
+            //闈㈡澘璁惧
+            else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘)
+            {
+                //骞叉帴鐐�
+                if (device.Type == DeviceType.OnOffSwitch)
+                {
+                    //娌充笢璁惧
+                    if (deviceEnumInfo.IsHdlDevice == true)
+                    {
+                        var form = new DevicePanel.PanelButtonSettionForm();
+                        form.AddForm(device);
+                    }
+                    else
+                    {
+                        var form = new DeviceDryContactSettionForm();
+                        form.AddForm(device);
+                    }
+                }
+                //缁х數鍣�
+                else if (device.Type == DeviceType.OnOffOutput)
+                {
+                    //娌充笢璁惧
+                    if (deviceEnumInfo.IsHdlDevice == true)
+                    {
+                        var form = new DevicePanel.PanelFunctionSettionForm();
+                        form.AddForm(device);
+                    }
+                    else
+                    {
+                        var form = new DeviceFunctionSettionForm();
+                        form.AddForm(device, true);
+                    }
+                }
+                //娓╂箍搴�
+                else if (device.Type == DeviceType.TemperatureSensor)
+                {
+                    var form = new DeviceFunctionSettionForm();
+                    form.AddForm(device, true);
+                }
+                else
+                {
+                    var form = new DeviceFunctionSettionForm();
+                    form.AddForm(device, true);
+                }
+            }
+            //濡傛灉鏄共鎺ョ偣
+            else if (device.Type == DeviceType.OnOffSwitch)
+            {
+                var form = new DeviceDryContactSettionForm();
+                form.AddForm(device);
+            }
+            else
+            {
+                var form = new DeviceFunctionSettionForm();
+                form.AddForm(device, true);
+            }
         }
 
         #endregion
@@ -770,30 +847,29 @@
         /// </summary>
         public override int FormActionAgainEvent()
         {
-            if (this.nowActionDeviceMac == null)
+            if (this.nowActionDeviceMac != null)
             {
-                return 1;
-            }
-            var rowInfo = this.dicRowInfo[nowActionDeviceMac];
-            //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎
-            if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0)
-            {
-                //绉婚櫎鎺т欢
-                rowInfo.dicDetailRow = null;
-                rowInfo.frameTable.RemoveFromParent();
-
-                this.dicRowInfo.Remove(nowActionDeviceMac);
-                rowInfo = null;
-            }
-            else
-            {
-                //鍒锋柊璁惧淇℃伅
-                rowInfo.MenuRow?.RefreshControlInfo(true);
-                if (rowInfo.dicDetailRow != null)
+                var rowInfo = this.dicRowInfo[nowActionDeviceMac];
+                //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎
+                if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0)
                 {
-                    foreach (var contr in rowInfo.dicDetailRow.Values)
+                    //绉婚櫎鎺т欢
+                    rowInfo.dicDetailRow = null;
+                    rowInfo.frameTable.RemoveFromParent();
+
+                    this.dicRowInfo.Remove(nowActionDeviceMac);
+                    rowInfo = null;
+                }
+                else
+                {
+                    //鍒锋柊璁惧淇℃伅
+                    rowInfo.MenuRow?.RefreshControlInfo(true);
+                    if (rowInfo.dicDetailRow != null)
                     {
-                        contr?.RefreshControlInfo();
+                        foreach (var contr in rowInfo.dicDetailRow.Values)
+                        {
+                            contr?.RefreshControlInfo();
+                        }
                     }
                 }
             }

--
Gitblit v1.8.0