From c0021397eeb8335d6d1f20990c71533c3d94e7af Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 10 一月 2020 17:02:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |  107 +++++++++++++++++++++++++----------------------------
 1 files changed, 51 insertions(+), 56 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 36aa8a7..26607da 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -1093,7 +1093,7 @@
                                         }
                                     })
                                     { IsBackground = true }.Start();
-                                    
+
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                     deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
@@ -1134,39 +1134,14 @@
                                     };
                                     deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                                     {
-                                        if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+                                        var lightControl = new Phone.Device.Light.OnOffControl();
+                                        UserView.HomePage.Instance.AddChidren(lightControl);
+                                        UserView.HomePage.Instance.PageIndex += 1;
+                                        lightControl.Show(deviceUI, Common.Room.CurrentRoom);
+                                        lightControl.action += (curDev, curRoom) =>
                                         {
-                                            var lightControl = new Phone.Device.Light.OnOffControl();
-                                            UserView.HomePage.Instance.AddChidren(lightControl);
-                                            UserView.HomePage.Instance.PageIndex += 1;
-                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
-                                            lightControl.action += (curDev, curRoom) =>
-                                            {
-                                                ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
-                                            };
-                                        }
-                                        else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
-                                        {
-                                            var lightControl = new Phone.Device.Light.PlugControl();
-                                            UserView.HomePage.Instance.AddChidren(lightControl);
-                                            UserView.HomePage.Instance.PageIndex += 1;
-                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
-                                            lightControl.action += (curDev, curRoom) =>
-                                            {
-                                                ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
-                                            };
-                                        }
-                                        else
-                                        {
-                                            var lightControl = new Phone.Device.Light.LightControl();
-                                            UserView.HomePage.Instance.AddChidren(lightControl);
-                                            UserView.HomePage.Instance.PageIndex += 1;
-                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
-                                            lightControl.action += (curDev, curRoom) =>
-                                            {
-                                                ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
-                                            };
-                                        }
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+                                        };
                                     };
 
                                     EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
@@ -1805,18 +1780,14 @@
         /// <param name="sameTypeList"></param>
         /// <param name="devListScrolView"></param>
         /// <param name="deviceRow"></param>
-        private void ReFreshDeviceAction(DeviceUI deviceUI,Common.Room curRoom,List<DeviceUI> sameTypeList,VerticalScrolViewLayout devListScrolView,CategoryFunctionRow deviceRow)
+        private void ReFreshDeviceAction(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionRow deviceRow)
         {
-            if (curRoom.Id != Common.Room.CurrentRoom.Id)
+            if (Common.Room.CurrentRoom.IsLove)
             {
-                if(Common.Room.CurrentRoom.IsLove)
+                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
+                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false)
                 {
-                    deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                }
-                else
-                {
-                    Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
                     devListScrolView.RemoveViewByTag(deviceUI);
                     sameTypeList.Remove(deviceUI);
                     if (sameTypeList.Count == 0)
@@ -1827,8 +1798,21 @@
             }
             else
             {
-                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                if (curRoom.Id != Common.Room.CurrentRoom.Id)
+                {
+                    Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
+                    devListScrolView.RemoveViewByTag(deviceUI);
+                    sameTypeList.Remove(deviceUI);
+                    if (sameTypeList.Count == 0)
+                    {
+                        RefreshFunction(Common.Room.CurrentRoom);
+                    }
+                }
+                else
+                {
+                    deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
+                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                }
             }
         }
 
@@ -1841,16 +1825,12 @@
         /// <param name="deviceRow"></param>
         private void ReFreshDeviceActionForWin(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionForWinRow deviceRow)
         {
-            if (curRoom.Id != Common.Room.CurrentRoom.Id)
+            if (Common.Room.CurrentRoom.IsLove)
             {
-                if (Common.Room.CurrentRoom.IsLove)
+                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
+                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false)
                 {
-                    deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                }
-                else
-                {
-                    Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
                     devListScrolView.RemoveViewByTag(deviceUI);
                     sameTypeList.Remove(deviceUI);
                     if (sameTypeList.Count == 0)
@@ -1861,8 +1841,21 @@
             }
             else
             {
-                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                if (curRoom.Id != Common.Room.CurrentRoom.Id)
+                {
+                    Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
+                    devListScrolView.RemoveViewByTag(deviceUI);
+                    sameTypeList.Remove(deviceUI);
+                    if (sameTypeList.Count == 0)
+                    {
+                        RefreshFunction(Common.Room.CurrentRoom);
+                    }
+                }
+                else
+                {
+                    deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
+                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                }
             }
         }
 
@@ -2213,7 +2206,8 @@
                             Common.Logic.CurrentLogic.IsEnable = 1;//榛樿涓哄紑
                             if (logiciocnBtn.Tag.ToString() == "3")
                             {
-                                Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;// Language.StringByID(MyInternationalizationString.automation1);
+                                Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;
+                                Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext);
                                 var addLogicPage = new Logic.AddLogicPage();
                                 HomePage.Instance.AddChidren(addLogicPage);
                                 HomePage.Instance.PageIndex += 1;
@@ -2223,6 +2217,7 @@
                             {
 
                                 Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;
+                                Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext);
                                 Logic.TemplatePage templatePage = new Logic.TemplatePage();
                                 Logic.TemplatePage.s = logiciocnBtn.Tag.ToString();
                                 HomePage.Instance.AddChidren(templatePage);
@@ -2877,4 +2872,4 @@
 
 
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0