From e7a71b8318fa26b8a85eac86e4c0a129f453d44f Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期三, 08 一月 2020 17:54:16 +0800
Subject: [PATCH] 2019.1.8

---
 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs              |   62 ++--
 ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs  |    3 
 ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs        |    2 
 ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml                       |   29 +-
 ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs          |    3 
 ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs          |    3 
 ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs         |    4 
 ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs  |    3 
 ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs    |    2 
 ZigbeeApp/Shared/R.cs                                        |    8 
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs           |   60 +++-
 ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs     |   80 +++++-
 ZigbeeApp/Shared/Phone/Device/Light/AirSwitchControl.cs      |  292 +++++++++++++++++++++---
 ZigbeeApp/Shared/Phone/Device/Light/PlugControl.cs           |    3 
 ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs                |    3 
 ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide                 |    0 
 ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs               |   16 
 ZigbeeApp/Shared/Common/Room.cs                              |   14 
 ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs |   72 +++--
 ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs        |    2 
 20 files changed, 476 insertions(+), 185 deletions(-)

diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
index 65a5a8f..6fcc2d4 100644
--- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
+++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -2,17 +2,18 @@
   <MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.M7BBB18B19152766" />
   <MonoDevelop.Ide.ItemProperties.GateWay.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.8c0bdb303f25d82c2a42fb8bfca449bfaca00260" />
   <MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.M7BBB18B19152766" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Light/PlugControl.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/UserView/UserPage.cs">
     <Files>
-      <File FileName="Shared/R.cs" Line="988" Column="13" />
+      <File FileName="Shared/R.cs" Line="1366" Column="1" />
       <File FileName="GateWay.Droid/Assets/Language.ini" />
-      <File FileName="Shared/Phone/UserView/UserHomeView.cs" Line="1207" Column="103" />
-      <File FileName="Shared/Phone/Device/Category/Category.cs" />
-      <File FileName="Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs" />
-      <File FileName="Shared/Common/Room.cs" />
-      <File FileName="Shared/Phone/Device/Light/OnOffControl.cs" Line="566" Column="10" />
-      <File FileName="Shared/Phone/Device/Light/LightControl.cs" Line="471" Column="19" />
-      <File FileName="Shared/Phone/Device/Light/PlugControl.cs" Line="423" Column="52" />
+      <File FileName="Shared/Phone/UserView/UserHomeView.cs" />
+      <File FileName="Shared/Phone/Device/Category/Category.cs" Line="1835" Column="16" />
+      <File FileName="Shared/Phone/Device/CommonForm/SceneCategoryView.cs" Line="434" Column="37" />
+      <File FileName="Shared/Phone/Device/CommonForm/SceneMainView.cs" Line="293" Column="22" />
+      <File FileName="Shared/Phone/Device/CommonForm/SelectZone.cs" Line="23" Column="34" />
+      <File FileName="Shared/Phone/Device/CommonForm/RoomView.cs" Line="86" Column="29" />
+      <File FileName="Shared/Phone/Device/Room/EditRoom.cs" Line="110" Column="29" />
+      <File FileName="Shared/Phone/UserView/UserPage.cs" Line="1" Column="1" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -34,13 +35,11 @@
                   <Node name="Category" expanded="True" />
                   <Node name="CommonForm" expanded="True" />
                   <Node name="Curtain" expanded="True" />
-                  <Node name="Light" expanded="True">
-                    <Node name="PlugControl.cs" selected="True" />
-                  </Node>
+                  <Node name="Light" expanded="True" />
+                  <Node name="Room" expanded="True" />
                 </Node>
-                <Node name="UserView" expanded="True" />
-                <Node name="ZigBee" expanded="True">
-                  <Node name="Device" expanded="True" />
+                <Node name="UserView" expanded="True">
+                  <Node name="UserPage.cs" selected="True" />
                 </Node>
               </Node>
             </Node>
diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
index c4cc576..9f64ad8 100644
--- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
+++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
Binary files differ
diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs
index 58819f9..df0c48c 100644
--- a/ZigbeeApp/Shared/Common/Room.cs
+++ b/ZigbeeApp/Shared/Common/Room.cs
@@ -337,13 +337,13 @@
             }
             Config.Instance.Home.InitFloor();
 
-            RefreshRoomListView();
+            CurrentRoom.RefreshRoomListView();
         }
 
         /// <summary>
         /// 鍒锋柊鎴块棿瑙嗗浘鍒楄〃
         /// </summary>
-        public static void RefreshRoomListView()
+        public void RefreshRoomListView()
         {
             Application.RunOnMainThread(() =>
             {
@@ -494,6 +494,9 @@
             Global.DeleteFilebyHomeId(roomFilePath);
             Lists.Remove(room);
             HdlAutoBackupLogic.DeleteFile(roomFilePath);
+
+            CurrentRoom.RefreshRoomListView();
+
             return true;
         }
 
@@ -1229,15 +1232,10 @@
         /// <summary>
         /// 鏄惁鏄敹钘忚澶�
         /// </summary>
-        /// <param name="room"></param>
         /// <param name="filePath"></param>
         /// <returns></returns>
-        public bool IsCollectInRoom(Room room,string filePath)
+        public bool IsCollectInRoom(string filePath)
         {
-            if(room.IsLove)
-            {
-                return true;
-            }
             if (GetLoveRoom().DeviceUIFilePathList.Find((obj) => obj == filePath) == null)
             {
                 return false;
diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
index a834293..385f525 100644
--- a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
@@ -413,8 +413,7 @@
                 }
             }
 
-            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (de == null)
+            if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName)==false)
             {
                 collectionBtn.IsSelected = false;
             }
diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index cef4542..fca0186 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -1780,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)
@@ -1802,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);
+                }
             }
         }
 
@@ -1816,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)
@@ -1836,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);
+                }
             }
         }
 
diff --git a/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs b/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs
index e5ed283..965cad9 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs
@@ -134,7 +134,7 @@
             {
                 Config.Instance.Home.CurrentFloorId = (sender as CommonForm.LeftIconButtonRow).Tag.ToString();
                 Config.Instance.Home.Save();
-                Common.Room.RefreshRoomListView();
+                Common.Room.CurrentRoom.RefreshRoomListView();
             }
             RemoveView();
             FloorAction?.Invoke((sender as CommonForm.LeftIconButtonRow).Tag.ToString());
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
index ccee116..12413ab 100644
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs
@@ -76,7 +76,7 @@
 
             AddTop();
 
-            AddBodyView(device);
+            AddBodyView(device,room);
 
         }
 
@@ -102,7 +102,7 @@
         /// <summary>
         /// AddBodyView
         /// </summary>
-        public void AddBodyView(DeviceUI device)
+        public void AddBodyView(DeviceUI device, Common.Room room)
         {
             bodyFrameLayout = new FrameLayout()
             {
@@ -182,32 +182,65 @@
             };
             infoFL.AddChidren(tipBtn);
 
-            var nameRow = new DeviceInfoEditRow(170);
+            var infoScrolView = new VerticalScrolViewLayout
+            {
+                Y = Application.GetRealHeight(170-12),
+                Height = Application.GetRealHeight(600),
+                ScrollEnabled = false,
+                VerticalScrollBarEnabled = false
+            };
+            infoFL.AddChidren(infoScrolView);
+
+            var nameFL = new FrameLayout
+            {
+                Height = Application.GetRealHeight(127 + 12)
+            };
+            infoScrolView.AddChidren(nameFL);
+            var nameRow = new DeviceInfoEditRow(12);
             nameRow.Init();
             nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionName)} : ");
             nameRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceEpointName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceEpointName);
-            infoFL.AddChidren(nameRow);
+            nameFL.AddChidren(nameRow);
 
-            var zoneRow = new DeviceInfoRow(308);
+            
+            var zoneFL = new FrameLayout
+            {
+                Height = Application.GetRealHeight(127 + 12)
+            };
+            if (room != null && room.IsLove == false)
+            {
+                infoScrolView.AddChidren(zoneFL);
+            }
+            var zoneRow = new DeviceInfoRow(12);
             zoneRow.Init();
             zoneRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongZone)} : ");
             zoneRow.SetTitle(roomName);
-            infoFL.AddChidren(zoneRow);
+            zoneFL.AddChidren(zoneRow);
 
-            var modelRow = new DeviceInfoRow(446);
+            var modelFL = new FrameLayout
+            {
+                Height = Application.GetRealHeight(127 + 12)
+            };
+            infoScrolView.AddChidren(modelFL);
+            var modelRow = new DeviceInfoRow(12);
             modelRow.Init();
             modelRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongModel)} : ");
             modelRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceName);
             modelRow.HideNext(true);
-            infoFL.AddChidren(modelRow);
+            modelFL.AddChidren(modelRow);
 
-            if (device.CommonDevice.Type==ZigBee.Device.DeviceType.OnOffOutput)
+            if (device.CommonDevice.Type==DeviceType.OnOffOutput || device.CommonDevice.Type==DeviceType.AirSwitch)
             {
-                functionTypeRow = new DeviceInfoRow(585);
+                var typeFL = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(127 + 12)
+                };
+                infoScrolView.AddChidren(typeFL);
+                functionTypeRow = new DeviceInfoRow(12);
                 functionTypeRow.Init();
                 functionTypeRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionType)} : ");
                 //functionTypeRow.SetTitle(device.CommonDevice.DfunctionType);
-                infoFL.AddChidren(functionTypeRow);
+                typeFL.AddChidren(functionTypeRow);
                 var dfunctionType = device.CommonDevice.DfunctionType;
 
                 //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
@@ -277,21 +310,8 @@
                         }
                     };
                 };
+            }
 
-                //sharedRow = new DeviceInfoRow(723);
-                //sharedRow.Init();
-                //sharedRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.Share)} : ");
-                //sharedRow.SetTitle("2浜�");
-                //infoFL.AddChidren(sharedRow);
-            }
-            else
-            {
-                //sharedRow = new DeviceInfoRow(585);
-                //sharedRow.Init();
-                //sharedRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.Share)} : ");
-                //sharedRow.SetTitle("2浜�");
-                //infoFL.AddChidren(sharedRow);
-            }
 
             var confirmBtn = new CommonForm.CompleteButton(962, 900, 127);
             confirmBtn.SetTitle(R.MyInternationalizationString.Save);
@@ -335,7 +355,7 @@
                         CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain));
                         return;
                     }
-                    if (device.CommonDevice.Type == ZigBee.Device.DeviceType.OnOffOutput)
+                    if (device.CommonDevice.Type == DeviceType.OnOffOutput || device.CommonDevice.Type == DeviceType.AirSwitch)
                     {
                         if (device.IsCustomizeImage == false)
                         {
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
index ee2e08c..8fda258 100644
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
@@ -83,7 +83,7 @@
                         //鏄惁涓哄綋鍓嶈澶�
                         if ((temperDevice?.DeviceEpoint != common.DeviceEpoint || temperDevice?.DeviceAddr != common.DeviceAddr) && (humidDevice?.DeviceEpoint != common.DeviceEpoint || humidDevice?.DeviceAddr != common.DeviceAddr) )
                         {
-                            //return;
+                            return;
                         }
 
                         //if (common.Type == DeviceType.TemperatureSensor)
@@ -308,6 +308,8 @@
                 var editRoom = new Device.Room.EditRoom();
                 HomePage.Instance.AddChidren(editRoom);
                 HomePage.Instance.PageIndex += 1;
+                editRoom.temperDevice = this.temperDevice;
+                editRoom.humidDevice = this.humidDevice;
                 editRoom.Show(room);
                 editRoom.action += () =>
                 {
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs
index 49ce8a9..90b6b05 100644
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneMainView.cs
@@ -279,7 +279,7 @@
                 {
                     return;
                 }
-                CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ControlSceneFail);
+                CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.ControlSceneFail));
             }
 
             scene.RemainTime = scene.SceneDelayTime;
diff --git a/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs b/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs
index e007b18..b0675e9 100644
--- a/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs
@@ -298,8 +298,7 @@
                 }
             }
 
-            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (de == null)
+            if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
             {
                 collectionBtn.IsSelected = false;
             }
diff --git a/ZigbeeApp/Shared/Phone/Device/Light/AirSwitchControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/AirSwitchControl.cs
index c69a094..8927f17 100644
--- a/ZigbeeApp/Shared/Phone/Device/Light/AirSwitchControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/AirSwitchControl.cs
@@ -8,7 +8,7 @@
 namespace Shared.Phone.Device.Light
 {
     /// <summary>
-    /// 鐏厜鎺у埗鐣岄潰
+    /// 寮�鍏�
     /// </summary>
     public class AirSwitchControl : FrameLayout, ZigBee.Common.IStatus
     {
@@ -62,12 +62,19 @@
         private FrameLayout bodyFrameLayout;
 
         private Button StatuBtn;
+        /// <summary>
+        /// OnBtn
+        /// </summary>
+        private Button OnBtn;
+        /// <summary>
+        /// OffBtn
+        /// </summary>
+        private Button OffBtn;
 
         /// <summary>
         /// IsDrawerLockMode
         /// </summary>
         public bool IsDrawerLockMode;
-
         #endregion
 
         #region 鈼� 鎺ュ彛__________________________
@@ -129,7 +136,7 @@
                         {
                             if (common.DeviceStatusReport.CluterID == 6)
                             {
-                                var light = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
+                                var light = deviceUI.CommonDevice as AirSwitch;
                                 light.DeviceStatusReport = common.DeviceStatusReport;
                                 //璁板綍銆佹洿鏂扮姸鎬�
                                 if (light.DeviceStatusReport.AttriBute == null || light.DeviceStatusReport.AttriBute.Count == 0)
@@ -137,8 +144,22 @@
                                     return;
                                 }
                                 light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData;
-                                deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1;
                                 StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}";
+
+                                if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+                                {
+                                    SetONOFFStatu(light.OnOffStatus == 1);
+                                }
+                                else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
+                                {
+                                    deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1;
+                                }
+                                else
+                                {
+                                    deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1;
+                                }
+
+
                                 light.LastDateTime = DateTime.Now;
                             }
                         }
@@ -151,7 +172,30 @@
             }
             else if (typeTag == "OnlineStatusChange")
             {
-
+                Application.RunOnMainThread(() =>
+                {
+                    try
+                    {
+                        var deviceUI = device;
+                        //璁惧涓虹┖
+                        if (deviceUI.CommonDevice == null)
+                        {
+                            return;
+                        }
+                        //鏄惁涓哄綋鍓嶈澶�
+                        if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
+                        {
+                            return;
+                        }
+                        deviceUI.CommonDevice.IsOnline = common.IsOnline;
+                        //OnBtn.IsSelected = OffBtn.IsSelected= deviceUI.CommonDevice.IsOnline == 1;
+                        deviceUI.CommonDevice.LastDateTime = DateTime.Now;
+                    }
+                    catch (Exception ex)
+                    {
+                        System.Console.WriteLine($"Error:{ex.Message}");
+                    }
+                });
             }
         }
         #endregion
@@ -197,7 +241,7 @@
             AddBodyView(device);
 
 
-            var light = dev.CommonDevice as ZigBee.Device.AirSwitch;
+            var light = dev.CommonDevice as AirSwitch;
             //琛ヤ笂闈炶繙绋�
             if (light.Gateway == null)
             {
@@ -219,8 +263,7 @@
                 }
             }
 
-            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (de == null)
+            if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
             {
                 collectionBtn.IsSelected = false;
             }
@@ -308,7 +351,7 @@
                 Text = device.CommonDevice.DeviceEpointName,
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                 TextSize = 15,
-                IsBold=true
+                IsBold = true
             };
             itemView.AddChidren(deviceNameBtn);
 
@@ -323,30 +366,6 @@
                 TextSize = 10
             };
             itemView.AddChidren(StatuBtn);
-
-            deviceIMG = new Button()
-            {
-                Y = Application.GetRealHeight(389),
-                Width = Application.GetMinRealAverage(377),
-                Height = Application.GetMinRealAverage(435),
-                Gravity = Gravity.CenterHorizontal,
-                UnSelectedImagePath = "Light/DeskLamp.png",
-                SelectedImagePath = "Light/DeskLampSelected.png",
-                IsSelected = (device.CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1
-            };
-            itemView.AddChidren(deviceIMG);
-
-            switchBtn = new Button()
-            {
-                Y = Application.GetRealHeight(996),
-                Width = Application.GetMinRealAverage(81),
-                Height = Application.GetMinRealAverage(81),
-                Gravity = Gravity.CenterHorizontal,
-                UnSelectedImagePath = "Item/Switch.png",
-                SelectedImagePath = "Item/SwitchSelected.png",
-                IsSelected = (device.CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1
-            };
-            itemView.AddChidren(switchBtn);
 
             var roomBG = new Button
             {
@@ -387,6 +406,138 @@
                 TextSize = 12
             };
             itemView.AddChidren(roomName);
+
+            AddByFunctionType(itemView);
+        }
+
+        /// <summary>
+        /// AddByFunctionType
+        /// </summary>
+        private void AddByFunctionType(FrameLayout itemView)
+        {
+            if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+            {
+                AddOnOff(itemView);
+            }
+            else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
+            {
+                AddPlug(itemView);
+            }
+            else
+            {
+                AddLight(itemView);
+            }
+        }
+
+        /// <summary>
+        /// AddOnOff
+        /// </summary>
+        private void AddOnOff(FrameLayout itemView)
+        {
+            deviceIMG = new Button()
+            {
+                Y = Application.GetRealHeight(340),
+                Width = Application.GetMinRealAverage(579),
+                Height = Application.GetMinRealAverage(579),
+                Gravity = Gravity.CenterHorizontal,
+                UnSelectedImagePath = "Light/OnOff.png",
+            };
+            itemView.AddChidren(deviceIMG);
+
+            OffBtn = new Button
+            {
+                X = Application.GetRealWidth(294),
+                Y = Application.GetRealHeight(588),
+                Width = Application.GetMinRealAverage(81),
+                Height = Application.GetMinRealAverage(81),
+                UnSelectedImagePath = "Light/OFF.png",
+                SelectedImagePath = "Light/OFFSelected.png",
+                IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 0
+            };
+            itemView.AddChidren(OffBtn);
+
+            OnBtn = new Button
+            {
+                X = Application.GetRealWidth(590),
+                Y = Application.GetRealHeight(588),
+                Width = Application.GetMinRealAverage(81),
+                Height = Application.GetMinRealAverage(81),
+                UnSelectedImagePath = "Light/ON.png",
+                SelectedImagePath = "Light/ONSelected.png",
+                IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1
+            };
+            itemView.AddChidren(OnBtn);
+
+            OnBtn.MouseUpEventHandler += ON;
+            OffBtn.MouseUpEventHandler += OFF;
+        }
+
+        /// <summary>
+        /// light
+        /// </summary>
+        /// <param name="itemView"></param>
+        private void AddLight(FrameLayout itemView)
+        {
+            deviceIMG = new Button()
+            {
+                Y = Application.GetRealHeight(389),
+                Width = Application.GetMinRealAverage(377),
+                Height = Application.GetMinRealAverage(435),
+                Gravity = Gravity.CenterHorizontal,
+                UnSelectedImagePath = "Light/DeskLamp.png",
+                SelectedImagePath = "Light/DeskLampSelected.png",
+                IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1
+            };
+            itemView.AddChidren(deviceIMG);
+
+            switchBtn = new Button()
+            {
+                Y = Application.GetRealHeight(996),
+                Width = Application.GetMinRealAverage(81),
+                Height = Application.GetMinRealAverage(81),
+                Gravity = Gravity.CenterHorizontal,
+                UnSelectedImagePath = "Item/Switch.png",
+                SelectedImagePath = "Item/SwitchSelected.png",
+                IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1
+            };
+            itemView.AddChidren(switchBtn);
+
+            switchBtn.MouseUpEventHandler += Switch;
+            deviceIMG.MouseUpEventHandler += Switch;
+        }
+
+        /// <summary>
+        /// plug
+        /// </summary>
+        /// <param name="itemView"></param>
+        private void AddPlug(FrameLayout itemView)
+        {
+            deviceIMG = new Button()
+            {
+                Y = Application.GetRealHeight(344),
+                Width = Application.GetMinRealAverage(567),
+                Height = Application.GetMinRealAverage(567),
+                Gravity = Gravity.CenterHorizontal,
+                UnSelectedImagePath = "Light/Plug.png",
+                SelectedImagePath = "Light/PlugSelected.png",
+                IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1
+            };
+            itemView.AddChidren(deviceIMG);
+
+            switchBtn = new Button()
+            {
+                Y = Application.GetRealHeight(996),
+                Width = Application.GetMinRealAverage(81),
+                Height = Application.GetMinRealAverage(81),
+                Gravity = Gravity.CenterHorizontal,
+                UnSelectedImagePath = "Item/Switch.png",
+                SelectedImagePath = "Item/SwitchSelected.png",
+                IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1
+            };
+            itemView.AddChidren(switchBtn);
+
+            switchBtn.MouseUpEventHandler += Switch;
+            deviceIMG.MouseUpEventHandler += Switch;
         }
 
         #endregion
@@ -397,8 +548,6 @@
         /// </summary>
         private void BindEvent()
         {
-            switchBtn.MouseUpEventHandler += Switch;
-            deviceIMG.MouseUpEventHandler += Switch;
             collectionBtn.MouseUpEventHandler += Collection;
         }
 
@@ -418,13 +567,14 @@
             switchBtn.IsSelected = !switchBtn.IsSelected;
             deviceIMG.IsSelected = !deviceIMG.IsSelected;
             StatuBtn.Text = deviceIMG.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Open)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}";
+
             if (switchBtn.IsSelected == true)
             {
-                (device.CommonDevice as ZigBee.Device.AirSwitch).SwitchControl(1);
+                (device.CommonDevice as AirSwitch).SwitchControl(1);
             }
             else
             {
-                (device.CommonDevice as ZigBee.Device.AirSwitch).SwitchControl(0);
+                (device.CommonDevice as AirSwitch).SwitchControl(0);
             }
             //鎺у埗寤舵椂鍥炶皟
             DeviceUI.SendCommandDelayAction(device.CommonDevice, () =>
@@ -441,6 +591,73 @@
             });
         }
 
+        /// <summary>
+        /// ON
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="eventArgs"></param>
+        private void ON(object sender, MouseEventArgs eventArgs)
+        {
+            SetONOFFStatu(true);
+            (device.CommonDevice as AirSwitch).SwitchControl(1);
+            //鎺у埗寤舵椂鍥炶皟
+            zbGateway.ReportAction += UpdateDeviceControllStatu;
+            DeviceUI.SendCommandDelayAction(device.CommonDevice, () =>
+            {
+                if (Parent == null)
+                {
+                    return;
+                }
+                RemoveUpdateControlDeviceStatuAction();
+                if (sendedControlCommand == false)
+                {
+                    DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL);
+                }
+            });
+        }
+        /// <summary>
+        /// OFF
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="eventArgs"></param>
+        private void OFF(object sender, MouseEventArgs eventArgs)
+        {
+            SetONOFFStatu(false);
+            (device.CommonDevice as AirSwitch).SwitchControl(0);
+            //鎺у埗寤舵椂鍥炶皟
+            zbGateway.ReportAction += UpdateDeviceControllStatu;
+            DeviceUI.SendCommandDelayAction(device.CommonDevice, () =>
+            {
+                if (Parent == null)
+                {
+                    return;
+                }
+                RemoveUpdateControlDeviceStatuAction();
+                if (sendedControlCommand == false)
+                {
+                    DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL);
+                }
+            });
+        }
+
+        /// <summary>
+        /// SetONOFFStatu
+        /// </summary>
+        /// <param name="statu"></param>
+        private void SetONOFFStatu(bool statu)
+        {
+            if (statu)
+            {
+                OnBtn.IsSelected = true;
+                OffBtn.IsSelected = false;
+            }
+            else
+            {
+                OnBtn.IsSelected = false;
+                OffBtn.IsSelected = true;
+            }
+            StatuBtn.Text = statu ? $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Open)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}";
+        }
 
 
         #endregion
@@ -473,6 +690,7 @@
         /// <param name="e">E.</param>
         private void Collection(object sender, MouseEventArgs e)
         {
+            //collection
             if ((sender as Button).IsSelected)
             {
                 Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName);
diff --git a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
index 5464f85..32958e2 100644
--- a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
@@ -574,8 +574,7 @@
         /// </summary>
         private void InitCollection()
         {
-            var dev = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (dev == null)
+            if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
             {
                 collectionBtn.IsSelected = false;
             }
diff --git a/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
index c85d124..bcbcbbc 100644
--- a/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
@@ -241,8 +241,7 @@
                 }
             }
 
-            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (de == null)
+            if(Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
             {
                 collectionBtn.IsSelected = false;
             }
diff --git a/ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs
index 6bf5fb6..e833131 100644
--- a/ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs
@@ -263,8 +263,7 @@
                 }
             }
 
-            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (de == null)
+            if(Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
             {
                 collectionBtn.IsSelected = false;
             }
diff --git a/ZigbeeApp/Shared/Phone/Device/Light/PlugControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/PlugControl.cs
index 0cb2631..6af3c76 100644
--- a/ZigbeeApp/Shared/Phone/Device/Light/PlugControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/PlugControl.cs
@@ -242,8 +242,7 @@
                 }
             }
 
-            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-            if (de == null)
+            if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
             {
                 collectionBtn.IsSelected = false;
             }
diff --git a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
index bc1f4e1..f824737 100644
--- a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
@@ -46,9 +46,9 @@
         /// </summary>
         public int OldIconPathType;
 
-        CommonDevice temperDevice;
+        public CommonDevice temperDevice;
 
-        CommonDevice humidDevice;
+        public CommonDevice humidDevice;
 
         DeviceInfoRow temperatureRow;
 
@@ -107,7 +107,7 @@
                         //鏄惁涓哄綋鍓嶈澶�
                         if ((temperDevice?.DeviceEpoint != common.DeviceEpoint || temperDevice?.DeviceAddr != common.DeviceAddr) && (humidDevice?.DeviceEpoint != common.DeviceEpoint || humidDevice?.DeviceAddr != common.DeviceAddr))
                         {
-                            //return;
+                            return;
                         }
 
                         //if (common.Type == DeviceType.TemperatureSensor)
@@ -349,6 +349,7 @@
                         return;
                     }
                     room.TemperatrueDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
+                    temperDevice=Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
                     temperatureRow.SetTitle(R.MyInternationalizationString.Getting);
                     //鍙戦�佽幏鍙栨俯搴︾殑鍛戒护
                     ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(selectTemp);
@@ -358,8 +359,8 @@
             {
                 temperatureRow.SetTitle(room.Temperatrue == 0 ? "--鈩�" : $"{room.Temperatrue}鈩�");
                 //鍙戦�佽幏鍙栨俯搴︾殑鍛戒护
-                var dev = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
-                ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(dev);
+                temperDevice = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
+                ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(temperDevice);
             }
             else
             {
@@ -386,6 +387,7 @@
                         return;
                     }
                     room.HumidityDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
+                    humidDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
                     humidityRow.SetTitle(R.MyInternationalizationString.Getting);
 
                     //鍙戦�佽幏鍙栨箍搴︾殑鍛戒护
@@ -396,8 +398,8 @@
             {
                 humidityRow.SetTitle(room.Humidity == 0 ? "--%" : $"{room.Humidity}%");
                 //鍙戦�佽幏鍙栨箍搴︾殑鍛戒护
-                var dev = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
-                ReadDeviceAttributeLogic.Instance.SendHumidityStatuComand(dev);
+                humidDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
+                ReadDeviceAttributeLogic.Instance.SendHumidityStatuComand(humidDevice);
             }
             else
             {
diff --git a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs
index 78c8c8e..f969dd1 100644
--- a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs
@@ -91,10 +91,10 @@
         /// </summary>
         public void Show()
         {
+            RemoveAll();
             InitData();
             AddTop();
             AddBodyView();
-
         }
 
         /// <summary>
diff --git a/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs b/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs
index a065ede..fac3c75 100644
--- a/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/SafetyShortcutControl.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using Shared.Common;
+using Shared.Phone.Device.CommonForm;
 using Shared.Phone.UserCenter;
 
 namespace Shared.Phone.UserView
@@ -112,9 +113,9 @@
             }
             atHome.ButtonClickEvent += (sender, e) =>
             {
-                if(sender.IsSelected)
+                dialog.Close();
+                if (sender.IsSelected)
                 {
-                    dialog.Close();
                     return;
                 }
                 CommonPage.Loading.Start();
@@ -124,10 +125,13 @@
                     Application.RunOnMainThread(() =>
                     {
                         CommonPage.Loading.Hide();
-                        dialog.Close();
                         if(result == GarrisonMode.AtHome)
                         {
-
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonSuccess));
+                        }
+                        else
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail));
                         }
                     });
 
@@ -148,17 +152,26 @@
             }
             withdrawGarriso.ButtonClickEvent += (sender, e) =>
             {
+                dialog.Close();
                 if (sender.IsSelected)
                 {
-                    dialog.Close();
                     return;
                 }
-                new System.Threading.Thread(() =>
+                CommonPage.Loading.Start();
+                new System.Threading.Thread(async () =>
                 {
-                    var result = HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true);
+                    var result = await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true);
                     Application.RunOnMainThread(() =>
                     {
-                        dialog.Close();
+                        CommonPage.Loading.Hide();
+                        if (result == 1)
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess));
+                        }
+                        else
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail));
+                        }
                     });
                 })
                 { IsBackground = true }.Start();
@@ -181,17 +194,26 @@
             }
             atHome.ButtonClickEvent += (sender, e) =>
             {
+                dialog.Close();
                 if (sender.IsSelected)
                 {
-                    dialog.Close();
                     return;
                 }
-                new System.Threading.Thread(() =>
+                CommonPage.Loading.Start();
+                new System.Threading.Thread(async () =>
                 {
-                    var result = HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome);
+                    var result =await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome);
                     Application.RunOnMainThread(() =>
                     {
-                        dialog.Close();
+                        CommonPage.Loading.Hide();
+                        if (result == GarrisonMode.AtHome)
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetAtHomeGarrisonSuccess));
+                        }
+                        else
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail));
+                        }
                     });
                 })
                 { IsBackground = true }.Start();
@@ -208,17 +230,26 @@
             }
             removeHome.ButtonClickEvent += (sender, e) =>
             {
+                dialog.Close();
                 if (sender.IsSelected)
                 {
-                    dialog.Close();
                     return;
                 }
-                new System.Threading.Thread(() =>
+                CommonPage.Loading.Start();
+                new System.Threading.Thread(async () =>
                 {
-                    var result = HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome);
+                    var result =await  HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome);
                     Application.RunOnMainThread(() =>
                     {
-                        dialog.Close();
+                        CommonPage.Loading.Hide();
+                        if (result == GarrisonMode.RemoveHome)
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetRemoveHomeGarrisonSuccess));
+                        }
+                        else
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail));
+                        }
                     });
                 })
                 { IsBackground = true }.Start();
@@ -235,17 +266,26 @@
             }
             withdrawGarriso.ButtonClickEvent += (sender, e) =>
             {
+                dialog.Close();
                 if (sender.IsSelected)
                 {
-                    dialog.Close();
                     return;
                 }
-                new System.Threading.Thread(() =>
+                CommonPage.Loading.Start();
+                new System.Threading.Thread(async () =>
                 {
-                    var result = HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true);
+                    var result =await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true);
                     Application.RunOnMainThread(() =>
                     {
-                        dialog.Close();
+                        CommonPage.Loading.Hide();
+                        if (result == 1)
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess));
+                        }
+                        else
+                        {
+                            CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail));
+                        }
                     });
                 })
                 { IsBackground = true }.Start();
diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index 2f4638f..3accaa7 100644
--- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -1130,10 +1130,9 @@
                                         functionView.SetStatuText(device.GetDeviceStatu());
                                         functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                         functionView.IsSelected = light.OnOffStatus == 1;
-                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
 
-                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                        if (dev == null)
+                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                         {
                                             functionView.CollectButton.IsSelected = false;
                                         }
@@ -1250,7 +1249,7 @@
                                         functionView.SetStatuText(device.GetDeviceStatu());
                                         functionView.SetDeviceName(airSwitch.DeviceEpointName);
                                         functionView.IsSelected = airSwitch.OnOffStatus == 1;
-                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom( device.FileName));
 
                                         functionView.SwitchButton.MouseUpEventHandler += (sender, e) =>
                                         {
@@ -1360,7 +1359,7 @@
                                         functionView.SetStatuText(device.GetDeviceStatu());
                                         functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                         functionView.IsSelected = ac.currentSystemMode != 0;
-                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
 
                                         functionView.SwitchButton.MouseUpEventHandler += (sender, e) =>
                                         {
@@ -1471,10 +1470,9 @@
                                         functionView.SetStatuText(device.GetDeviceStatu());
                                         functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                         functionView.IsSelected = dimmableLight.OnOffStatus == 1;
-                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
 
-                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                        if (dev == null)
+                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                         {
                                             functionView.CollectButton.IsSelected = false;
                                         }
@@ -1568,10 +1566,9 @@
                                     lightView.SetStatuText(device.GetDeviceStatu());
                                     lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                     lightView.IsSelected = ias.iASInfo?.Alarm1 == 1;
-                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                     lightView.CanControl(false);
-                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                    if (dev == null)
+                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                     {
                                         lightView.CollectButton.IsSelected = false;
                                     }
@@ -1629,10 +1626,9 @@
                                         lightView.SetStatuText(device.GetDeviceStatu());
                                         lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                         lightView.IsSelected = false;
-                                        lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                        lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                         lightView.CanControl(false);
-                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                        if (dev == null)
+                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                         {
                                             lightView.CollectButton.IsSelected = false;
                                         }
@@ -1655,11 +1651,10 @@
                                     lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                     lightView.SetStatuText(device.GetDeviceStatu());
                                     lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
-                                    lightView.IsSelected = dimmableLight.IsOnline == 1;
-                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                    lightView.IsSelected = false;
+                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                     lightView.CanControl(false);
-                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                    if (dev == null)
+                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                     {
                                         lightView.CollectButton.IsSelected = false;
                                     }
@@ -1689,10 +1684,9 @@
                                     lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                     lightView.CanControl(false);
                                     //lightView.IsSelected = device.CommonDevice.IsOnline == 1;
-                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
+                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
 
-                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
-                                    if (dev == null)
+                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                     {
                                         lightView.CollectButton.IsSelected = false;
                                     }
@@ -1722,23 +1716,29 @@
         /// <param name="functionView"></param>
         private void ReFreshEditDeviceAction(DeviceUI device, Common.Room curRoom, FunctionMainView functionView)
         {
-            if (curRoom.Id != Common.Room.CurrentRoom.Id)
+            if (Common.Room.CurrentRoom.IsLove)
             {
-                if (Common.Room.CurrentRoom.IsLove)
+                functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
+                functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                if (Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                 {
-                    functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
-                    functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
-                }
-                else
-                {
-                    Common.Room.CurrentRoom.DeleteDevice(device.FileName);
                     ShowFunction();
                 }
             }
             else
             {
-                functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
-                functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                if (curRoom.Id != Common.Room.CurrentRoom.Id)
+                {
+
+                    Common.Room.CurrentRoom.DeleteDevice(device.FileName);
+                    ShowFunction();
+                }
+                else
+                {
+                    functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
+                    functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
+                    functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
+                }
             }
         }
 
diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs
index df6c3c0..c7cb925 100644
--- a/ZigbeeApp/Shared/R.cs
+++ b/ZigbeeApp/Shared/R.cs
@@ -1366,10 +1366,10 @@
 
 
 
-		/// <summary>
-		/// 瀵嗙爜闀垮害涓簕0}涓瓧绗�
-		/// </summary>
-		public const int PswLengthMsg = 15000;
+        /// <summary>
+        /// 瀵嗙爜闀垮害涓簕0}涓瓧绗�
+        /// </summary>
+        public const int PswLengthMsg = 15000;
         /// <summary>
         /// 1涓皬鍐欏瓧姣�
         /// </summary>

--
Gitblit v1.8.0