From 163777d8a2cb7cfa469f54a7042528870ebc10a3 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 09 十二月 2019 17:46:20 +0800
Subject: [PATCH] 一个新版本

---
 ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs |   54 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
index 2fc4517..f9eb44b 100755
--- 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>
@@ -60,7 +60,7 @@
             room = r;
             IconPathType = r.BackgroundImageType;
             OldIconPathType= r.BackgroundImageType;
-            if (IconPathType != 1)
+            if (IconPathType != 0)
             {
                 OldBackgroundImagePath = r.BackgroundImage;
             }
@@ -75,6 +75,7 @@
             HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
             HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
 
+            CommonPage.Instance.IsDrawerLockMode = false;
             base.RemoveFromParent();
         }
 
@@ -108,26 +109,21 @@
             };
             AddChidren(bodyFrameLayout);
 
-            var imgFL = new Button
-            {
-                Y = Application.GetRealHeight(60),
-                Width = Application.GetMinRealAverage(916),
-                Height = Application.GetMinRealAverage(487),
-                Gravity = Gravity.CenterHorizontal,
-                UnSelectedImagePath = "Room/Room_Rectangle.png"
-            };
-            bodyFrameLayout.AddChidren(imgFL);
-
-            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)
             };
             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
@@ -137,6 +133,8 @@
                 BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
             };
             bodyFrameLayout.AddChidren(infoFL);
+            var rectCornerID = HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight;
+            infoFL.SetCornerWithSameRadius(Application.GetRealHeight(50), rectCornerID);
 
             var infoEdit = new Button
             {
@@ -156,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();
@@ -184,11 +186,10 @@
                     }
                 };
             }
-            
+
             var temperatureRow = new DeviceInfoRow(446);
             temperatureRow.Init();
             temperatureRow.SetTipTitle(R.MyInternationalizationString.Temperature);
-            temperatureRow.SetTitle("26.8鈩�");
             temperatureRow.NameText.TextAlignment = TextAlignment.CenterRight;
             infoFL.AddChidren(temperatureRow);
             temperatureRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
@@ -300,7 +301,6 @@
             var humidityRow = new DeviceInfoRow(585);
             humidityRow.Init();
             humidityRow.SetTipTitle(R.MyInternationalizationString.Humidity);
-            humidityRow.SetTitle("66.5%");
             humidityRow.NameText.TextAlignment = TextAlignment.CenterRight;
             infoFL.AddChidren(humidityRow);
             humidityRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
@@ -308,6 +308,7 @@
                 var tem = new RoomHumiditySetting { };
                 HomePage.Instance.AddChidren(tem);
                 HomePage.Instance.PageIndex += 1;
+                tem.tempDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
                 tem.Show(room);
                 tem.selectDeviceAction = (selectTemp) =>
                 {
@@ -398,18 +399,18 @@
                 var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
                 var fileName = $"RoomIcon_{tradeTime}.png";
                 room.Name = nameRow.NameText.Text.Trim();
-                if (OldIconPathType != 1)
+                if (OldIconPathType != 0)
                 {
-                    Shared.IO.FileUtils.DeleteFile(OldBackgroundImagePath);
+                    Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath,OldBackgroundImagePath));
                 }
                 if (IconPathType == 0)
                 {
-                    room.BackgroundImage = backGround.UnSelectedImagePath;
+                    room.BackgroundImage = backGround.ImagePath;
                 }
                 else
                 {
                     Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes);
-                    room.BackgroundImage = System.IO.Path.Combine(Config.Instance.FullPath, fileName);
+                    room.BackgroundImage = fileName;
                 }
                 room.BackgroundImageType = IconPathType;
                 room.Save();
@@ -515,7 +516,8 @@
                 localPic.action = (imgPath) =>
                 {
                     IconPathType = 0;
-                    backGround.UnSelectedImagePath = imgPath;
+                    backGround.ImageBytes = null;
+                    backGround.ImagePath = imgPath;
                 };
             };
             selectPhotographBtn.MouseUpEventHandler += (send, ee) =>
@@ -528,12 +530,12 @@
                 {
                     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);
@@ -549,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