From e5f993f52e09eb46878baced83bb8492f147d41c Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 04 十一月 2019 17:58:40 +0800
Subject: [PATCH] 2019-11-04-1

---
 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs |   73 +++++++++++++++++++++---------------
 1 files changed, 43 insertions(+), 30 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
old mode 100644
new mode 100755
index 22b59c0..f124a63
--- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -128,10 +128,10 @@
                             {
                                 case DeviceType.OnOffOutput:
                                     //寮�鍏冲姛鑳�
-                                    if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 6)
+                                    if (common.DeviceStatusReport.CluterID == 6)
                                     {
                                         var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight;
-                                        onOffOutputLight.DeviceStatusReport = (common as ZigBee.Device.ToggleLight).DeviceStatusReport;
+                                        onOffOutputLight.DeviceStatusReport = common.DeviceStatusReport;
 
                                         //璁板綍銆佹洿鏂扮姸鎬�
                                         if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0)
@@ -149,10 +149,10 @@
 
                                 case DeviceType.AirSwitch:
                                     //寮�鍏冲姛鑳�
-                                    if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 6)
+                                    if (common.DeviceStatusReport.CluterID == 6)
                                     {
                                         var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
-                                        airSwitch.DeviceStatusReport = (common as ZigBee.Device.AirSwitch).DeviceStatusReport;
+                                        airSwitch.DeviceStatusReport = common.DeviceStatusReport;
                                         for (int j = 0; j < frameLayout.ChildrenCount; j++)
                                         {
                                             var tempView = frameLayout.GetChildren(j);
@@ -175,7 +175,7 @@
                                         }
                                     }
                                     //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
-                                    if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 3)
+                                    if (common.DeviceStatusReport.CluterID == 3)
                                     {
                                         var airSwitch = deviceUI.CommonDevice as AirSwitch;
                                         airSwitch.IsOnline = 1;
@@ -197,18 +197,18 @@
                                     break;
 
                                 case DeviceType.WindowCoveringDevice:
-                                    if ((common as Rollershade).DeviceStatusReport.CluterID == 258)
+                                    if (common.DeviceStatusReport.CluterID == 258)
                                     {
-                                        if ((common as Rollershade).DeviceStatusReport.AttriBute[0].AttributeId == 0)
+                                        if (common.DeviceStatusReport.AttriBute[0].AttributeId == 0)
                                         {
                                             //绐楀笜绫诲瀷
                                             var rollerShade = deviceUI.CommonDevice as Rollershade;
-                                            rollerShade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport;
-                                            rollerShade.WcdType = (common as Rollershade).DeviceStatusReport.AttriBute[0].AttriButeData;
+                                            rollerShade.DeviceStatusReport = common.DeviceStatusReport;
+                                            rollerShade.WcdType = common.DeviceStatusReport.AttriBute[0].AttriButeData;
                                             rollerShade.LastDateTime = DateTime.Now;
                                         }
                                     }
-                                    if ((common as ZigBee.Device.Rollershade).DeviceStatusReport.CluterID == 3)
+                                    if (common.DeviceStatusReport.CluterID == 3)
                                     {
                                         var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
                                         rollershade.IsOnline = 1;
@@ -231,10 +231,10 @@
 
                                 case DeviceType.Thermostat:
                                     //AC鍔熻兘
-                                    if ((common as ZigBee.Device.AC).DeviceStatusReport.CluterID == 513)
+                                    if (common.DeviceStatusReport.CluterID == 513)
                                     {
                                         var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
-                                        ac.DeviceStatusReport = (common as ZigBee.Device.AC).DeviceStatusReport;
+                                        ac.DeviceStatusReport = common.DeviceStatusReport;
                                         var attriButeList = ac.DeviceStatusReport.AttriBute;
                                         if (attriButeList == null || attriButeList.Count == 0)
                                         {
@@ -297,7 +297,7 @@
 
                                     }
                                     //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
-                                    if ((common as ZigBee.Device.AC).DeviceStatusReport.CluterID == 3)
+                                    if (common.DeviceStatusReport.CluterID == 3)
                                     {
                                         var ac = deviceUI.CommonDevice as AC;
                                         ac.IsOnline = 1;
@@ -322,10 +322,10 @@
                                 case DeviceType.DimmableLight:
                                     //璋冨厜鐏姛鑳�
                                     //寮�鍏冲姛鑳�
-                                    if ((common as DimmableLight).DeviceStatusReport.CluterID == 6)
+                                    if (common.DeviceStatusReport.CluterID == 6)
                                     {
                                         var dimmableLight = deviceUI.CommonDevice as DimmableLight;
-                                        dimmableLight.DeviceStatusReport = (common as DimmableLight).DeviceStatusReport;
+                                        dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
                                         //璁板綍銆佹洿鏂扮姸鎬�
                                         if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
                                         {
@@ -339,10 +339,10 @@
                                     }
 
                                     //浜害
-                                    if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 8)
+                                    if (common.DeviceStatusReport.CluterID == 8)
                                     {
                                         var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
-                                        dimmableLight.DeviceStatusReport = (common as ZigBee.Device.DimmableLight).DeviceStatusReport;
+                                        dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
                                         var attriButeList = dimmableLight.DeviceStatusReport.AttriBute;
                                         if (attriButeList == null || attriButeList.Count == 0)
                                         {
@@ -380,7 +380,7 @@
                     }
                 });
             }
-           
+
         }
         /// <summary>
         /// Changeds the IL ogic status.
@@ -853,7 +853,7 @@
             {
                 ShowNoGatewayTip();
             }
-
+
         }
 
         #endregion
@@ -975,8 +975,8 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void GoToAddGateWay(object sender, MouseEventArgs mouseEventArgs)
         {
-            var selectNewGateWayForm = new UserCenter.GatewayAdd.NewGateWaySelectForm { };
-            selectNewGateWayForm.AddForm(selectNewGateWayForm);
+            var selectNewGateWayForm = new UserCenter.GatewayAdd.NewGateWayMenuSelectForm { };
+            selectNewGateWayForm.AddForm();
         }
 
         #endregion
@@ -1028,7 +1028,7 @@
             else
             {
                 deviceVerticalScrolViewLayout = new VerticalScrolViewLayout { };
-                
+
                 functionSceneBodyView.AddChidren(deviceVerticalScrolViewLayout);
                for(int i=0;i<deviceList.Count;i++)
                 {
@@ -1052,7 +1052,7 @@
                         deviceVerticalScrolViewLayout.AddChidren(itemView);
                     }
 
-                   
+
                     //鍒犻櫎璁惧
                     EventHandler<MouseEventArgs> delEvent = (sender, e) =>
                     {
@@ -1073,12 +1073,12 @@
                     {
                         if ((sender as Button).IsSelected)
                         {
-                            Shared.Common.Room.GetLoveRoom().DeleteDevice(device.FileName);
+                            Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName);
                             (sender as Button).IsSelected = false;
                         }
                         else
                         {
-                            Shared.Common.Room.GetLoveRoom().AddDevice(device.FileName);
+                            Shared.Common.Room.CurrentRoom.GetLoveRoom().AddDevice(device.FileName);
                             (sender as Button).IsSelected = true;
                         }
                         if (Room.CurrentRoom.IsLove)
@@ -2379,7 +2379,7 @@
                     sceneView.Init();
                     sceneView.SetSceneNameText(scene.Name);
                     sceneView.SetIcon($"SceneIcon/{i}.png");
-                    sceneView.SetCollect(scene.IsCollected);
+                    sceneView.SetCollect(Common.Room.CurrentRoom.GetLoveRoom().SceneUIFilePathList.Contains(scene.FileName));
 
                     if (scene.SceneDelayTime == 0)
                     {
@@ -2439,17 +2439,30 @@
                     //鏀惰棌
                     EventHandler<MouseEventArgs> collectionEvent = (sender, e) =>
                     {
+                        (sender as Button).IsSelected = !(sender as Button).IsSelected;
                         if ((sender as Button).IsSelected)
                         {
-                            scene.Collect(false);
-                            (sender as Button).IsSelected = false;
+                            //scene.IsCollected = true;
+                            Room.CurrentRoom.GetLoveRoom().AddScene(scene);
                         }
                         else
                         {
-                            scene.Collect(true);
-                            (sender as Button).IsSelected = true;
+                            //scene.IsCollected = false;
+                            Room.CurrentRoom.GetLoveRoom().RemoveScene(scene);
                         }
                         scene.Save();
+
+                        //if ((sender as Button).IsSelected)
+                        //{
+                        //    scene.Collect(false);
+                        //    (sender as Button).IsSelected = false;
+                        //}
+                        //else
+                        //{
+                        //    scene.Collect(true);
+                        //    (sender as Button).IsSelected = true;
+                        //}
+                        //scene.Save();
                         //if (Room.CurrentRoom.IsLove)
                         //{
                         //    RefreshBodyView();

--
Gitblit v1.8.0