From bd46c57c77c276014db3192a4e2cc96e23c93202 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 21 二月 2020 13:08:47 +0800
Subject: [PATCH] 先上传个版本吧

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |  349 +++++++++++++++++++++++++---------------------------------
 1 files changed, 151 insertions(+), 198 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 5170e45..75e410e 100755
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -284,14 +284,6 @@
                                                     ac.currentSystemMode = attList.AttriButeData;
                                                     ac.LastDateTime = DateTime.Now;
                                                     break;
-                                                case 4099:
-                                                    var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0');
-                                                    var modeStr = value.Substring(value.Length - 5, 5);
-                                                    for (int j = 0; j < modeStr.Length; j++)
-                                                    {
-                                                        ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
-                                                    }
-                                                    break;
                                                 case 4097:
                                                     //杩囪檻缃戞竻娲楁爣蹇�:42
                                                     ac.CleanStatu = attList.AttriButeData == 42;
@@ -1093,10 +1085,10 @@
                                         }
                                     })
                                     { IsBackground = true }.Start();
-                                    
+
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                     deviceRow.IsSelected = light.OnOffStatus == 1;
                                     deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1134,30 +1126,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.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
-                                        }
-                                        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.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
-                                        }
-                                        else
-                                        {
-                                            var lightControl = new Phone.Device.Light.LightControl();
-                                            UserView.HomePage.Instance.AddChidren(lightControl);
-                                            UserView.HomePage.Instance.PageIndex += 1;
-                                            //lightControl.action = RefreshBodyView;
-                                            lightControl.Show(deviceUI, Common.Room.CurrentRoom);
-                                        }
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+                                        };
                                     };
 
                                     EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
@@ -1168,21 +1144,7 @@
                                         detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                         detailInfo.EditAction += (curDevice, curRoom) =>
                                         {
-                                            if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                            {
-                                                Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                                deviceRow.RemoveFromParent();
-                                                sameTypeList.Remove(deviceUI);
-                                                if (sameTypeList.Count == 0)
-                                                {
-                                                    RefreshFunction(Common.Room.CurrentRoom);
-                                                }
-                                            }
-                                            else
-                                            {
-                                                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                            }
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                         };
                                     };
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1224,7 +1186,7 @@
 
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                     deviceRow.IsSelected = airSwitch.OnOffStatus == 1;
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                     deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1265,8 +1227,13 @@
                                         var lightControl = new Phone.Device.Light.AirSwitchControl();
                                         UserView.HomePage.Instance.AddChidren(lightControl);
                                         UserView.HomePage.Instance.PageIndex += 1;
-                                        //lightControl.action = RefreshBodyView;
                                         lightControl.Show(deviceUI, Common.Room.CurrentRoom);
+                                        lightControl.action += (curDev, curRoom) =>
+                                        {
+
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+
+                                        };
                                     };
 
                                     EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
@@ -1277,21 +1244,8 @@
                                         detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                         detailInfo.EditAction += (curDevice, curRoom) =>
                                         {
-                                            if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                            {
-                                                Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                                deviceRow.RemoveFromParent();
-                                                sameTypeList.Remove(deviceUI);
-                                                if (sameTypeList.Count == 0)
-                                                {
-                                                    RefreshFunction(Common.Room.CurrentRoom);
-                                                }
-                                            }
-                                            else
-                                            {
-                                                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                            }
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+
                                         };
                                     };
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1333,7 +1287,7 @@
 
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                     deviceRow.IsSelected = dimmableLight.OnOffStatus == 1;
                                     deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1376,8 +1330,12 @@
                                         UserView.HomePage.Instance.AddChidren(dimmableLightControl);
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
-                                        //dimmableLightControl.action = RefreshBodyView;
                                         dimmableLightControl.Show(deviceUI, Common.Room.CurrentRoom);
+                                        dimmableLightControl.action += (curDev, curRoom) =>
+                                        {
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+                                        };
+
                                     };
 
                                     EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
@@ -1388,21 +1346,7 @@
                                         detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                         detailInfo.EditAction += (curDevice, curRoom) =>
                                         {
-                                            if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                            {
-                                                Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                                deviceRow.RemoveFromParent();
-                                                sameTypeList.Remove(deviceUI);
-                                                if (sameTypeList.Count == 0)
-                                                {
-                                                    RefreshFunction(Common.Room.CurrentRoom);
-                                                }
-                                            }
-                                            else
-                                            {
-                                                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                            }
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                         };
                                     };
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1446,8 +1390,7 @@
 
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                    //deviceRow.SetOnLineStatu(ac.IsOnline == 1);
+                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                     deviceRow.IsSelected = ac.currentSystemMode != 1;
                                     deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1490,8 +1433,12 @@
                                         UserView.HomePage.Instance.AddChidren(acControl);
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
-                                        //rollerShadeControl.action = RefreshBodyView;
                                         acControl.Show(deviceUI, Common.Room.CurrentRoom);
+                                        acControl.action += (curDev, curRoom) =>
+                                        {
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+
+                                        };
                                     };
 
                                     EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
@@ -1502,21 +1449,8 @@
                                         detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                         detailInfo.EditAction += (curDevice, curRoom) =>
                                         {
-                                            if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                            {
-                                                Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                                deviceRow.RemoveFromParent();
-                                                sameTypeList.Remove(deviceUI);
-                                                if (sameTypeList.Count == 0)
-                                                {
-                                                    RefreshFunction(Common.Room.CurrentRoom);
-                                                }
-                                            }
-                                            else
-                                            {
-                                                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                            }
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+
                                         };
                                     };
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1559,7 +1493,7 @@
 
                                     var deviceRow = new CategoryFunctionForWinRow(0, 35);
                                     deviceRow.Init(deviceUI);
-                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                     deviceRow.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage != 0;
                                     deviceRow.SetRollerShadeIcon(rollerShade.WcdType);
@@ -1588,8 +1522,11 @@
                                         UserView.HomePage.Instance.AddChidren(rollerShadeControl);
                                         UserView.HomePage.Instance.PageIndex += 1;
                                         UserView.HomePage.Instance.ScrollEnabled = false;
-                                        //rollerShadeControl.action = RefreshBodyView;
                                         rollerShadeControl.Show(deviceUI, Common.Room.CurrentRoom);
+                                        rollerShadeControl.action += (curDev, curRoom) =>
+                                        {
+                                            ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+                                        };
                                     };
 
                                     EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
@@ -1600,21 +1537,7 @@
                                         detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                         detailInfo.EditAction += (curDevice, curRoom) =>
                                         {
-                                            if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                            {
-                                                Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                                deviceRow.RemoveFromParent();
-                                                sameTypeList.Remove(deviceUI);
-                                                if (sameTypeList.Count == 0)
-                                                {
-                                                    RefreshFunction(Common.Room.CurrentRoom);
-                                                }
-                                            }
-                                            else
-                                            {
-                                                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                            }
+                                            ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                         };
                                     };
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1626,14 +1549,13 @@
                                         deviceTypeRowLayout.AddRightView(editBtn);
                                         editBtn.MouseUpEventHandler += deviceDetailHandler;
                                     }
-
                                 }
                             }
                             else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock)
                             {
                                 var deviceRow = new CategoryFunctionRow(0, 35);
                                 deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                 deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                 deviceRow.HideSwitchBtn(true);
                                 deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1653,21 +1575,7 @@
                                     detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                     detailInfo.EditAction += (curDevice, curRoom) =>
                                     {
-                                        if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                        {
-                                            Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                            deviceRow.RemoveFromParent();
-                                            sameTypeList.Remove(deviceUI);
-                                            if (sameTypeList.Count == 0)
-                                            {
-                                                RefreshFunction(Common.Room.CurrentRoom);
-                                            }
-                                        }
-                                        else
-                                        {
-                                            deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                            deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                        }
+                                        ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                     };
                                 };
                                 var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1684,7 +1592,7 @@
                             {
                                 var deviceRow = new CategoryFunctionRow(0, 35);
                                 deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                 deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                 deviceRow.IsSelected = (deviceUI.CommonDevice as IASZone).iASInfo?.Alarm1 == 1;
                                 deviceRow.HideSwitchBtn(true);
@@ -1698,21 +1606,7 @@
                                     detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                     detailInfo.EditAction += (curDevice, curRoom) =>
                                     {
-                                        if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                        {
-                                            Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                            deviceRow.RemoveFromParent();
-                                            sameTypeList.Remove(deviceUI);
-                                            if (sameTypeList.Count == 0)
-                                            {
-                                                RefreshFunction(Common.Room.CurrentRoom);
-                                            }
-                                        }
-                                        else
-                                        {
-                                            deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                            deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                        }
+                                        ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                     };
                                 };
                                 var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1766,7 +1660,7 @@
 
                                     var deviceRow = new CategoryFunctionRow(0, 35);
                                     deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                     deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                     deviceRow.IsSelected = false;
                                     deviceRow.HideSwitchBtn(true);
@@ -1780,21 +1674,7 @@
                                         detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                         detailInfo.EditAction += (curDevice, curRoom) =>
                                         {
-                                            if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                            {
-                                                Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                                deviceRow.RemoveFromParent();
-                                                sameTypeList.Remove(deviceUI);
-                                                if (sameTypeList.Count == 0)
-                                                {
-                                                    RefreshFunction(Common.Room.CurrentRoom);
-                                                }
-                                            }
-                                            else
-                                            {
-                                                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                            }
+                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                         };
                                     };
                                     var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1812,7 +1692,7 @@
                             {
                                 var deviceRow = new CategoryFunctionRow(0, 35);
                                 deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
+                                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
                                 deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                 deviceRow.HideSwitchBtn(true);
                                 deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1825,21 +1705,7 @@
                                     detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                     detailInfo.EditAction += (curDevice, curRoom) =>
                                     {
-                                        if (curRoom.Id != Common.Room.CurrentRoom.Id)
-                                        {
-                                            Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
-                                            deviceRow.RemoveFromParent();
-                                            sameTypeList.Remove(deviceUI);
-                                            if (sameTypeList.Count == 0)
-                                            {
-                                                RefreshFunction(Common.Room.CurrentRoom);
-                                            }
-                                        }
-                                        else
-                                        {
-                                            deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
-                                            deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
-                                        }
+                                        ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                     };
                                 };
                                 var editBtn = new CommonForm.RowLayoutEditButton()
@@ -1852,7 +1718,6 @@
                                     editBtn.MouseUpEventHandler += deviceDetailHandler;
                                 }
                             }
-
 
                             //鍒犻櫎璁惧
                             EventHandler<MouseEventArgs> delEvent = (delSender, delE) =>
@@ -1874,7 +1739,7 @@
                                         sameTypeList.Remove(deviceUI);
                                         if (Common.Room.CurrentRoom.GetLoveRoom().DeviceUIList.Find((obj) => obj.FileName == deviceUI.FileName) != null)
                                         {
-                                            Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
+                                            Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(deviceUI.FileName);
                                         }
                                     }
                                     if (sameTypeList.Count == 0)
@@ -1899,6 +1764,93 @@
                 { IsBackground = true }.Start();
             }
         }
+
+        /// <summary>
+        /// ReFreshDeviceAction
+        /// </summary>
+        /// <param name="curRoom"></param>
+        /// <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)
+        {
+            if (Common.Room.CurrentRoom.IsLove)
+            {
+                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
+                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
+                if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false)
+                {
+                    devListScrolView.RemoveViewByTag(deviceUI);
+                    sameTypeList.Remove(deviceUI);
+                    if (sameTypeList.Count == 0)
+                    {
+                        RefreshFunction(Common.Room.CurrentRoom);
+                    }
+                }
+            }
+            else
+            {
+                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(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
+                }
+            }
+        }
+
+        /// <summary>
+        /// ReFreshDeviceAction
+        /// </summary>
+        /// <param name="curRoom"></param>
+        /// <param name="sameTypeList"></param>
+        /// <param name="devListScrolView"></param>
+        /// <param name="deviceRow"></param>
+        private void ReFreshDeviceActionForWin(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionForWinRow deviceRow)
+        {
+            if (Common.Room.CurrentRoom.IsLove)
+            {
+                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
+                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
+                if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false)
+                {
+                    devListScrolView.RemoveViewByTag(deviceUI);
+                    sameTypeList.Remove(deviceUI);
+                    if (sameTypeList.Count == 0)
+                    {
+                        RefreshFunction(Common.Room.CurrentRoom);
+                    }
+                }
+            }
+            else
+            {
+                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(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice));
+                }
+            }
+        }
+
 
         /// <summary>
         /// AddRoomView
@@ -2245,7 +2197,7 @@
                             if (logiciocnBtn.Tag.ToString() == "3")
                             {
                                 Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;
-                                Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext);
+                                //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;
@@ -2255,7 +2207,7 @@
                             {
 
                                 Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;
-                                Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext);
+                                //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);
@@ -2460,7 +2412,10 @@
                     var logicCommunalPage = new Logic.LogicCommunalPage();
                     HomePage.Instance.AddChidren(logicCommunalPage);
                     HomePage.Instance.PageIndex += 1;
-                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview,no); });
+                    logicCommunalPage.Show(() => { 
+                        logicnameBtn.Text = logic.LogicName;
+                        Automationview(refresview,no);
+                    });
 
                 };
 
@@ -2475,18 +2430,16 @@
                 logicRowlayout.AddRightView(del);
                 del.MouseUpEventHandler += (sender, e) =>
                 {
-                    var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete),
-                                             Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim));
-                    alert.ResultEventHandler += (sender1, e1) =>
-                    {
-                        if (e1)
-                        {
-                            Common.Logic.LogicList.Remove(logic);
-                            Automationview(refresview,no);
-                            Logic.Send.DelLogic(logic.LogicId);
-                        }
+                    var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+                      Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+                      Language.StringByID(MyInternationalizationString.confrim));
+                    alert.Show();
+                    alert.ConfirmClickEvent += () =>
+                    {
+                        Common.Logic.LogicList.Remove(logic);
+                        Automationview(refresview, no);
+                        Logic.Send.DelLogic(logic.LogicId);
                     };
-                    alert.Show();
 
                 };
                 var line = new Button

--
Gitblit v1.8.0