From c26d742cef5ac268ca902b6605512b6476a26bc2 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 05 十二月 2019 15:22:27 +0800
Subject: [PATCH] 2019.12.5

---
 ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs |   64 +++++++++++++++++---------------
 1 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
index 551355a..6561293 100644
--- a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
@@ -29,7 +29,7 @@
         /// <summary>
         /// backGround
         /// </summary>
-        private Button backGround;
+        private ImageView backGround;
         /// <summary>
         /// IconPathType
         /// </summary>
@@ -72,8 +72,8 @@
 
         public override void RemoveFromParent()
         {
-            HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
-            HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
 
             CommonPage.Instance.IsDrawerLockMode = false;
             base.RemoveFromParent();
@@ -109,21 +109,21 @@
             };
             AddChidren(bodyFrameLayout);
 
-            backGround = new Button()
+            backGround = new ImageView()
             {
                 Y = Application.GetRealHeight(60),
                 Width = Application.GetMinRealAverage(887),
                 Height = Application.GetMinRealAverage(444),
                 Gravity = Gravity.CenterHorizontal,
                 Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius),
-                UnSelectedImagePath = room.BackgroundImage
+                ImagePath = room.BackgroundImageType == 0 ? room.BackgroundImage : System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage)
             };
-            if (room.BackgroundImageType != 0)
-            {
-                backGround.UnSelectedImagePath = System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage);
-            }
             bodyFrameLayout.AddChidren(backGround);
             backGround.SetViewShadow(true);
+            if (room.BackgroundImageType != 0)
+            {
+                backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(backGround.ImagePath);
+            }
             backGround.MouseUpEventHandler += backGroundIMGHander;
 
             var infoFL = new FrameLayout
@@ -154,6 +154,10 @@
             nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.RoomName)} :");
             nameRow.SetTitle(room.Name);
             infoFL.AddChidren(nameRow);
+            if(room.IsLove)
+            {
+                nameRow.NameText.Enable = false;
+            }
 
             var floorRow = new DeviceInfoRow(308);
             floorRow.Init();
@@ -182,7 +186,7 @@
                     }
                 };
             }
-            
+
             var temperatureRow = new DeviceInfoRow(446);
             temperatureRow.Init();
             temperatureRow.SetTipTitle(R.MyInternationalizationString.Temperature);
@@ -203,8 +207,8 @@
                     }
                     room.TemperatrueDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
 
-                    HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
-                    HdlDeviceAttributeLogic.Current.AddAttributeEvent("TemperatrueDevice", "DeviceStatusReport", (Action<ZigBee.Device.CommonDevice>)((report) =>
+                    HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+                    HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (Action<ZigBee.Device.CommonDevice>)((report) =>
                     {
                         string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
                         if (room.TemperatrueDevice != mainKeys)
@@ -212,7 +216,7 @@
                             return;
                         }
                         //绉婚櫎鎺変簨浠�
-                        HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
+                        HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
 
                         foreach (var data in report.DeviceStatusReport.AttriBute)
                         {
@@ -248,8 +252,8 @@
 
             if (string.IsNullOrEmpty(room.TemperatrueDevice) == false)
             {
-                HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
-                HdlDeviceAttributeLogic.Current.AddAttributeEvent("TemperatrueDevice", "DeviceStatusReport", (Action<ZigBee.Device.CommonDevice>)((report) =>
+                HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+                HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (Action<ZigBee.Device.CommonDevice>)((report) =>
                 {
                     string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
                     if (room.TemperatrueDevice != mainKeys)
@@ -257,7 +261,7 @@
                         return;
                     }
                     //绉婚櫎鎺変簨浠�
-                    HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
+                    HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
 
                     foreach (var data in report.DeviceStatusReport.AttriBute)
                     {
@@ -314,8 +318,8 @@
                     }
                     room.HumidityDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
 
-                    HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
-                    HdlDeviceAttributeLogic.Current.AddAttributeEvent("HumidityDevice", "DeviceStatusReport", (report) =>
+                    HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+                    HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
                     {
                         string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
                         if (room.HumidityDevice != mainKeys)
@@ -323,7 +327,7 @@
                             return;
                         }
                         //绉婚櫎鎺変簨浠�
-                        HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+                        HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
                         foreach (var data in report.DeviceStatusReport.AttriBute)
                         {
                             if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
@@ -349,8 +353,8 @@
             };
             if (string.IsNullOrEmpty(room.HumidityDevice) == false)
             {
-                HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
-                HdlDeviceAttributeLogic.Current.AddAttributeEvent("HumidityDevice", "DeviceStatusReport", (report) =>
+                HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+                HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
                 {
                     string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
                     if (room.HumidityDevice != mainKeys)
@@ -358,7 +362,7 @@
                         return;
                     }
                     //绉婚櫎鎺変簨浠�
-                    HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+                    HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
                     foreach (var data in report.DeviceStatusReport.AttriBute)
                     {
                         if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
@@ -393,7 +397,7 @@
             confirm.MouseUpEventHandler += (sender, e) =>
             {
                 var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
-                var fileName = $"Room_{tradeTime}";
+                var fileName = $"RoomIcon_{tradeTime}.png";
                 room.Name = nameRow.NameText.Text.Trim();
                 if (OldIconPathType != 0)
                 {
@@ -401,7 +405,7 @@
                 }
                 if (IconPathType == 0)
                 {
-                    room.BackgroundImage = backGround.UnSelectedImagePath;
+                    room.BackgroundImage = backGround.ImagePath;
                 }
                 else
                 {
@@ -513,25 +517,25 @@
                 {
                     IconPathType = 0;
                     backGround.ImageBytes = null;
-                    backGround.UnSelectedImagePath = imgPath;
+                    backGround.ImagePath = imgPath;
                 };
             };
             selectPhotographBtn.MouseUpEventHandler += (send, ee) =>
             {
                 selectFL.RemoveFromParent();
                 var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
-                var fileName = $"Room_{tradeTime}";
+                var fileName = $"RoomIcon_{tradeTime}.png";
                 //閫氳繃鐩告満鎷嶇収瑁佸壀
                 CropImage.TakePicture((imagePath) =>
                 {
                     if (IconPathType != 0)
                     {
-                        Global.DeleteFilebyHomeId(backGround.UnSelectedImagePath);
+                        Global.DeleteFilebyHomeId(backGround.ImagePath);
                     }
 
                     IconPathType = 1;
                     backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath);
-                    backGround.UnSelectedImagePath = imagePath;
+                    backGround.ImagePath = imagePath;
                     System.IO.File.Delete(imagePath);
 
                 }, fileName, 2, 1);
@@ -547,12 +551,12 @@
                 {
                     if (IconPathType != 0)
                     {
-                        Global.DeleteFilebyHomeId(backGround.UnSelectedImagePath);
+                        Global.DeleteFilebyHomeId(backGround.ImagePath);
                     }
 
                     IconPathType = 2;
                     backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath);
-                    backGround.UnSelectedImagePath = imagePath;
+                    backGround.ImagePath = imagePath;
                     System.IO.File.Delete(imagePath);
 
                 }, fileName, 2, 1);

--
Gitblit v1.8.0