From f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 30 十二月 2019 13:32:33 +0800
Subject: [PATCH] 2019-12-30-1

---
 ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs |   51 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs
index 40b3042..63086d9 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs
@@ -54,19 +54,26 @@
             //娓呯┖bodyFrame
             this.ClearBodyFrame();
 
+            //鎴块棿鍥剧墖
+            var framePic = new FrameLayout();
+            framePic.Y = Application.GetRealHeight(60);
+            framePic.Width = Application.GetMinRealAverage(887);
+            framePic.Height = Application.GetMinRealAverage(444);
+            framePic.Gravity = Gravity.CenterHorizontal;
+            framePic.Radius = 8;
+            framePic.BackgroundColor = UserCenterColor.Current.BodyFrameLayout;
+            bodyFrameLayout.AddChidren(framePic);
             var btnPic = new ImageView();
-            btnPic.Y = Application.GetRealHeight(60);
-            btnPic.Width = Application.GetMinRealAverage(887);
-            btnPic.Height = Application.GetMinRealAverage(444);
-            btnPic.Gravity = Gravity.CenterHorizontal;
-            btnPic.Radius = 17;
-            btnPic.ImagePath = "Room/r0.png";
-            bodyFrameLayout.AddChidren(btnPic);
+            btnPic.Radius = 8;
+            btnPic.ImagePath = "RoomIcon/0.JPG";
+            framePic.AddChidren(btnPic);
             btnPic.MouseUpEventHandler += (sender, e) =>
             {
                 //鎴块棿鍥剧墖閫夋嫨
                 this.RoomPictrueSelect(btnPic);
             };
+            //娣诲姞闃村奖鐗规晥
+            framePic.SetViewShadow(true);
 
             this.newRoom = new Common.Room();
             newRoom.FloorId = this.floorKeys;
@@ -163,13 +170,15 @@
                 if (newRoom.BackgroundImageType == 1 || newRoom.BackgroundImageType == 2)
                 {
                     //鐢熸垚鍥剧墖
-                    string picName = $"Room_{DateTime.Now.ToString("yyyyMMddHHmmss")}";
+                    string picName = $"RoomIcon_{DateTime.Now.ToString("yyyyMMddHHmmss")}.png";
                     string picFullName = System.IO.Path.Combine(Common.Config.Instance.FullPath, picName);
                     Shared.IO.FileUtils.WriteFileByBytes(picFullName, btnPic.ImageBytes);
-                    newRoom.BackgroundImage = picFullName;
+                    newRoom.BackgroundImage = picName;
                     //澶囦唤
                     Phone.UserCenter.HdlAutoBackupLogic.AddOrEditorFile(picName);
                 }
+
+                newRoom.FloorId = this.floorKeys;
                 var result = newRoom.AddRoom(newRoom);
                 if (result == false)
                 {
@@ -272,8 +281,8 @@
             //鑾峰彇涓�...
             btnTemper.Text = Language.StringByID(R.MyInternationalizationString.uGetting);
 
-            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 (newRoom.TemperatrueDevice != mainKeys || btnTemper == null)
@@ -281,7 +290,7 @@
                     return;
                 }
                 //绉婚櫎鎺変簨浠�
-                HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
+                HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
 
                 foreach (var data in report.DeviceStatusReport.AttriBute)
                 {
@@ -365,8 +374,8 @@
             //鑾峰彇涓�...
             btnHumi.Text = Language.StringByID(R.MyInternationalizationString.uGetting);
 
-            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 (newRoom.HumidityDevice != mainKeys || btnHumi == null)
@@ -374,7 +383,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)
@@ -425,7 +434,8 @@
                     }
                     this.newRoom.BackgroundImageType = 0;
                     this.newRoom.BackgroundImage = imgPath;
-                    imageContr.ImagePath = imgPath;
+                    imgPath = IO.FileUtils.GetImageFilePath(imgPath);
+                    imageContr.ImageBytes = IO.FileUtils.ReadFile(imgPath);
                 };
             });
             //鎷嶇収
@@ -468,14 +478,14 @@
         /// <summary>
         /// 鐣岄潰鍏抽棴
         /// </summary>
-        public override void CloseForm()
+        public override void CloseFormBefore()
         {
             this.FinishEditorEvent = null;
 
-            HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
-            HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
 
-            base.CloseForm();
+            base.CloseFormBefore();
         }
 
         #endregion
@@ -511,7 +521,6 @@
                     return false;
                 }
             }
-            newRoom.FloorId = this.floorKeys;
 
             return true;
         }

--
Gitblit v1.8.0