From 94e4e5b9fd3da964c44b7b14227d6fe2bbb426d7 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 02 四月 2020 13:56:39 +0800
Subject: [PATCH] 2020-04-02-2

---
 ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs |   77 ++++++++++++++++----------------------
 1 files changed, 33 insertions(+), 44 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
index 8fda258..a843033 100755
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
@@ -13,10 +13,6 @@
         /// Room
         /// </summary>
         private Common.Room room;
-        /// <summary>
-        /// action
-        /// </summary>
-        public Action action;
 
         FrameLayout roomNameBackground;
 
@@ -33,31 +29,7 @@
         CommonDevice humidDevice;
 
         #region 鈼� 鎺ュ彛__________________________
-        /// <summary>
-        /// 澶勭悊鍙樺寲浜嬩欢 --灏嗗純鐢� 鏀圭敤DeviceInfoChange()
-        /// </summary>
-        /// <returns>The changed.</returns>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
-        {
-
-        }
-        /// <summary>
-        /// Changeds the IL ogic status.
-        /// </summary>
-        /// <param name="logic">Logic.</param>
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-            //throw new NotImplementedException();
-        }
-        /// <summary>
-        /// Changeds the IS cene status.
-        /// </summary>
-        /// <param name="scene">Scene.</param>
-        public void ChangedISceneStatus(Scene scene)
-        {
-            //throw new NotImplementedException();
-        }
+      
         /// <summary>
         /// 璁惧鐘舵�佹洿鏂版帴鍙�
         /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para>
@@ -180,16 +152,19 @@
         /// <param name="r"></param>
         public void Init(Common.Room r)
         {
+            this.RemoveAll();
+
             this.room = r;
 
-            this.temperDevice= Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
+            this.temperDevice = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
 
-            this.humidDevice= Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
+            this.humidDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
 
             var roomBackView = new FrameLayout()
             {
                 Width = Application.GetRealWidth(717),
-                Height = Application.GetRealHeight(478)
+                Height = Application.GetRealHeight(478),
+                Radius = (uint)Application.GetRealHeight(17)
             };
             AddChidren(roomBackView);
 
@@ -199,6 +174,14 @@
                 Radius = (uint)Application.GetRealHeight(17)
             };
             roomBackView.AddChidren(roomImg);
+
+            //鍔犱釜鐗规畩鐨勯伄缃�
+            var frameBackGroudTemp = new FrameLayout();
+            frameBackGroudTemp.Width = roomBackView.Width;
+            frameBackGroudTemp.Height = roomBackView.Height;
+            frameBackGroudTemp.Radius = roomBackView.Radius;
+            frameBackGroudTemp.BackgroundColor = 0x12000000;
+            roomBackView.AddChidren(frameBackGroudTemp);
 
             roomNameBackground = new FrameLayout
             {
@@ -250,10 +233,14 @@
             {
                 X = Application.GetRealWidth(69),
                 Width = Application.GetRealWidth(120),
-                Text = room.Temperatrue == 0 ? "--鈩�" : $"{room.Temperatrue}鈩�",
+                Text = "--鈩�",
                 TextSize = 14,
                 TextAlignment=TextAlignment.CenterLeft
             };
+            if (string.IsNullOrEmpty(room.TemperatrueDevice) == false)
+            {
+                temperatureText.Text = room.Temperatrue == 0 ? "0.0鈩�" : room.Temperatrue.ToString() + "鈩�";
+            }
             roomTemperatureBackground.AddChidren(temperatureText);
             temperatureText.Width = temperatureText.GetTextWidth() + Application.GetRealWidth(60);
 
@@ -271,16 +258,20 @@
             {
                 X = humidityIcon.Right,
                 Width = Application.GetRealWidth(120),
-                Text = room.Humidity == 0 ? "--%" : $"{room.Humidity}%",
+                Text = "--%",
                 TextSize = 14,
                 TextAlignment = TextAlignment.CenterLeft
             };
+            if (string.IsNullOrEmpty(room.HumidityDevice) == false)
+            {
+                humidityText.Text = room.Humidity == 0 ? "0.0%" : room.Humidity.ToString() + "%";
+            }
             roomTemperatureBackground.AddChidren(humidityText);
             humidityText.Width = humidityText.GetTextWidth() + Application.GetRealWidth(60);
             roomTemperatureBackground.Width = (humidityText.Width + temperatureText.Width + Application.GetRealWidth(150)) > Application.GetRealWidth(600) ? Application.GetRealWidth(600) : (humidityText.Width + temperatureText.Width + Application.GetRealWidth(150));
 
             if (string.IsNullOrEmpty(room.TemperatrueDevice) == false)
-            {
+            {
                 //鍙戦�佽幏鍙栨俯搴︾殑鍛戒护
                 var dev = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
                 ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(dev);
@@ -305,15 +296,13 @@
             roomListBtn.MouseUpEventHandler += (send, e) =>
             {
                 CommonPage.Instance.IsDrawerLockMode = true;
-                var editRoom = new Device.Room.EditRoom();
-                HomePage.Instance.AddChidren(editRoom);
-                HomePage.Instance.PageIndex += 1;
-                editRoom.temperDevice = this.temperDevice;
-                editRoom.humidDevice = this.humidDevice;
-                editRoom.Show(room);
-                editRoom.action += () =>
-                {
-                    action?.Invoke();
+
+                var form = new UserCenter.Residence.EditorRoomInforForm();
+                form.AddForm(room);
+                form.FinishEditorEvent += (roomName2) =>
+                {
+                    //閲嶆柊鍒锋柊鎺т欢
+                    this.Init(this.room);
                 };
             };
         }

--
Gitblit v1.8.0