From 5204bc34549ba4718158c447cbb3c74b39ffe163 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期一, 02 十二月 2019 16:03:29 +0800
Subject: [PATCH] 2019.12.2

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

diff --git a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
index 875a6c7..7145309 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>
@@ -60,7 +60,7 @@
             room = r;
             IconPathType = r.BackgroundImageType;
             OldIconPathType= r.BackgroundImageType;
-            if (IconPathType != 1)
+            if (IconPathType != 0)
             {
                 OldBackgroundImagePath = r.BackgroundImage;
             }
@@ -109,14 +109,14 @@
             };
             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)
             };
             bodyFrameLayout.AddChidren(backGround);
             backGround.SetViewShadow(true);
@@ -389,11 +389,11 @@
             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 != 1)
+                if (OldIconPathType != 0)
                 {
-                    Shared.IO.FileUtils.DeleteFile(OldBackgroundImagePath);
+                    Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath,OldBackgroundImagePath));
                 }
                 if (IconPathType == 0)
                 {
@@ -402,7 +402,7 @@
                 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();
@@ -516,7 +516,7 @@
             {
                 selectFL.RemoveFromParent();
                 var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
-                var fileName = $"Room_{tradeTime}";
+                var fileName = $"RoomIcon_{tradeTime}.png";
                 //閫氳繃鐩告満鎷嶇収瑁佸壀
                 CropImage.TakePicture((imagePath) =>
                 {

--
Gitblit v1.8.0