From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期三, 25 十二月 2019 11:21:06 +0800
Subject: [PATCH] 2019.12.25

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

diff --git a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
index 6561293..15ae5d4 100644
--- a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
@@ -44,7 +44,7 @@
         /// </summary>
         public int OldIconPathType;
 
-
+        
         #endregion
 
         public EditRoom()
@@ -162,30 +162,31 @@
             var floorRow = new DeviceInfoRow(308);
             floorRow.Init();
             floorRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongFloor)} :");
-            infoFL.AddChidren(floorRow);
-            if (!room.IsLove)
+            if (Config.Instance.Home.FloorDics.Count > 0 && room.IsLove == false)
             {
-                floorRow.SetTitle(room.FloorName);
-                floorRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
-                {
-                    if (Config.Instance.Home.FloorDics != null)
-                    {
-                        List<string> floorIds = new List<string> { };
-                        List<string> floorNames = new List<string> { };
-                        foreach (var floor in Config.Instance.Home.FloorDics)
-                        {
-                            floorIds.Add(floor.Key);
-                            floorNames.Add(floor.Value);
-                        }
-
-                        PickerView.Show(floorNames, (index) =>
-                        {
-                            room.FloorId = floorIds[index];
-                            floorRow.SetTitle(room.FloorName);
-                        }, floorIds.IndexOf(room.FloorId), Language.StringByID(R.MyInternationalizationString.BelongFloor), Language.StringByID(R.MyInternationalizationString.Confrim), Language.StringByID(R.MyInternationalizationString.Cancel));
-                    }
-                };
+                infoFL.AddChidren(floorRow);
             }
+            floorRow.SetTitle(room.FloorName);
+            floorRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                if (Config.Instance.Home.FloorDics != null)
+                {
+                    List<string> floorIds = new List<string> { };
+                    List<string> floorNames = new List<string> { };
+                    foreach (var floor in Config.Instance.Home.FloorDics)
+                    {
+                        floorIds.Add(floor.Key);
+                        floorNames.Add(floor.Value);
+                    }
+
+                    PickerView.Show(floorNames, (index) =>
+                    {
+                        room.FloorId = floorIds[index];
+                        floorRow.SetTitle(room.FloorName);
+                    }, floorIds.IndexOf(room.FloorId), Language.StringByID(R.MyInternationalizationString.BelongFloor), Language.StringByID(R.MyInternationalizationString.Confrim), Language.StringByID(R.MyInternationalizationString.Cancel));
+                }
+            };
+
 
             var temperatureRow = new DeviceInfoRow(446);
             temperatureRow.Init();
@@ -206,6 +207,7 @@
                         return;
                     }
                     room.TemperatrueDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
+                    temperatureRow.SetTitle(R.MyInternationalizationString.Getting);
 
                     HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
                     HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (Action<ZigBee.Device.CommonDevice>)((report) =>
@@ -226,6 +228,7 @@
                                 {
                                     //0鈩�
                                     temperatureRow.NameText.Text = "0.0鈩�";
+                                    room.Temperatrue = 0;
                                 }
                                 else if (data.AttriButeData > 32767)
                                 {
@@ -234,6 +237,7 @@
                                     //灏忔暟鐐归渶瑕佷竴浣�
                                     strValue = strValue.Substring(0, strValue.Length - 1);
                                     temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+                                    room.Temperatrue = int.Parse(strValue) * 0.1;
                                 }
                                 else
                                 {
@@ -241,6 +245,7 @@
                                     string strValue = data.AttriButeData.ToString();
                                     strValue = strValue.Substring(0, strValue.Length - 1);
                                     temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+                                    room.Temperatrue = int.Parse(strValue) *0.1;
                                 }
                             }
                         }
@@ -249,9 +254,9 @@
                     (selectTemp as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity();
                 };
             };
-
             if (string.IsNullOrEmpty(room.TemperatrueDevice) == false)
             {
+                temperatureRow.SetTitle(R.MyInternationalizationString.Getting);
                 HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
                 HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (Action<ZigBee.Device.CommonDevice>)((report) =>
                 {
@@ -271,6 +276,7 @@
                             {
                                 //0鈩�
                                 temperatureRow.NameText.Text = "0.0鈩�";
+                                room.Temperatrue = 0;
                             }
                             else if (data.AttriButeData > 32767)
                             {
@@ -279,6 +285,7 @@
                                 //灏忔暟鐐归渶瑕佷竴浣�
                                 strValue = strValue.Substring(0, strValue.Length - 1);
                                 temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+                                room.Temperatrue = int.Parse(strValue) * 0.1;
                             }
                             else
                             {
@@ -286,6 +293,7 @@
                                 string strValue = data.AttriButeData.ToString();
                                 strValue = strValue.Substring(0, strValue.Length - 1);
                                 temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+                                room.Temperatrue = int.Parse(strValue) * 0.1;
                             }
                         }
                     }
@@ -297,6 +305,11 @@
                     (dev as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity();
                 }
             }
+            else
+            {
+                temperatureRow.SetTitle(R.MyInternationalizationString.No);
+            }
+
 
             var humidityRow = new DeviceInfoRow(585);
             humidityRow.Init();
@@ -317,6 +330,7 @@
                         return;
                     }
                     room.HumidityDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
+                    humidityRow.SetTitle(R.MyInternationalizationString.Getting);
 
                     HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
                     HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
@@ -336,6 +350,7 @@
                                 {
                                     //0
                                     humidityRow.NameText.Text = "0.0%";
+                                    room.Humidity = 0;
                                 }
                                 else
                                 {
@@ -343,6 +358,7 @@
                                     string strValue = data.AttriButeData.ToString();
                                     strValue = strValue.Substring(0, strValue.Length - 1);
                                     humidityRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "%";
+                                    room.Humidity = int.Parse(strValue) * 0.1;
                                 }
                             }
                         }
@@ -353,6 +369,7 @@
             };
             if (string.IsNullOrEmpty(room.HumidityDevice) == false)
             {
+                humidityRow.SetTitle(R.MyInternationalizationString.Getting);
                 HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
                 HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
                 {
@@ -371,6 +388,7 @@
                             {
                                 //0
                                 humidityRow.NameText.Text = "0.0%";
+                                room.Humidity = 0;
                             }
                             else
                             {
@@ -378,6 +396,7 @@
                                 string strValue = data.AttriButeData.ToString();
                                 strValue = strValue.Substring(0, strValue.Length - 1);
                                 humidityRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "%";
+                                room.Humidity = int.Parse(strValue) * 0.1;
                             }
                         }
                     }
@@ -389,9 +408,18 @@
                     (dev as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity();
                 }
             }
+            else
+            {
+                humidityRow.SetTitle(R.MyInternationalizationString.No);
+            }
 
+            if (Config.Instance.Home.FloorDics.Count == 0 || room.IsLove)
+            {
+                temperatureRow.Y = Application.GetRealHeight(308);
+                humidityRow.Y= Application.GetRealHeight(446);
+            }
 
-            var confirm = new Device.CommonForm.CompleteButton(1700, 700, 127);
+            var confirm = new Device.CommonForm.CompleteButton(1700, 900, 127);
             confirm.SetTitle(R.MyInternationalizationString.Confrim);
             AddChidren(confirm);
             confirm.MouseUpEventHandler += (sender, e) =>
@@ -417,7 +445,6 @@
                 action?.Invoke();
                 RemoveFromParent();
             };
-
         }
 
         /// <summary>
@@ -447,24 +474,25 @@
                 Height = Application.GetRealHeight(450),
                 Width = Application.GetRealWidth(selectRow_Width),
                 Gravity = Gravity.CenterHorizontal,
-                Radius = (uint)Application.GetRealHeight(17),
+                Radius = (uint)Application.GetRealHeight(35),
                 BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor
             };
             selectFL.AddChidren(itemFL);
-            itemFL.Animate = Animate.DownToUp;
+            //itemFL.Animate = Animate.DownToUp;
 
             var selectLocalPicture = new Button()
             {
                 Height = Application.GetRealHeight(selectRow_Height) - 1,
                 TextID = R.MyInternationalizationString.LocalPicture,
-                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                TextSize = 17
             };
             itemFL.AddChidren(selectLocalPicture);
             var selectLocalLine = new Button()
             {
                 Y = selectLocalPicture.Bottom,
                 Height = 1,
-                BackgroundColor = ZigbeeColor.Current.GXCLineColor
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
             };
             itemFL.AddChidren(selectLocalLine);
 
@@ -473,14 +501,15 @@
                 Y = selectLocalLine.Bottom,
                 Height = Application.GetRealHeight(selectRow_Height) - 1,
                 TextID = R.MyInternationalizationString.Photograph,
-                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                TextSize = 17
             };
             itemFL.AddChidren(selectPhotographBtn);
             var selectPhotographLine = new Button()
             {
                 Y = selectPhotographBtn.Bottom,
                 Height = 1,
-                BackgroundColor = ZigbeeColor.Current.GXCLineColor,
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2,
             };
             itemFL.AddChidren(selectPhotographLine);
 
@@ -489,7 +518,8 @@
                 Y = selectPhotographLine.Bottom,
                 Height = Application.GetRealHeight(selectRow_Height) - 1,
                 TextID = R.MyInternationalizationString.MyAblums,
-                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                TextSize = 17
             };
             itemFL.AddChidren(selectAblumsBtn);
 
@@ -502,7 +532,8 @@
                 TextID = R.MyInternationalizationString.Cancel,
                 TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
                 BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor,
-                Radius = (uint)Application.GetRealHeight(17)
+                Radius = (uint)Application.GetRealHeight(35),
+                TextSize = 17
             };
             selectFL.AddChidren(cancelBtn);
 

--
Gitblit v1.8.0