From 0058d3fd5cf6052016ae744aeca2272623bfb6c8 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 28 十月 2019 17:49:52 +0800
Subject: [PATCH] 2019-10-28-2

---
 ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs |  112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 108 insertions(+), 4 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
index 72ab9f6..a511835 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
@@ -156,7 +156,8 @@
                 DeviceType.IASZone,
                 DeviceType.OnOffSwitch,
                 DeviceType.OnOffOutput,//妤兼鐏�
-                DeviceType.DoorLock
+                DeviceType.DoorLock,
+                DeviceType.TemperatureSensor,
             };
 
             ///妤煎眰鐐瑰嚮浜嬩欢
@@ -205,6 +206,8 @@
                     EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
                     {
                         roomhorizontalScrol.RemoveAll();
+                        devicetypehorizontalScrol.RemoveAll();
+                        middle.RemoveAll();
                         foolrname.Text = btnfoolrname.Text;
                         flMain.RemoveFromParent();
                         var list = Send.GetRoomList(btnfoolrname.Tag.ToString());
@@ -222,7 +225,7 @@
             ///绗竴娆¤繘鏉�
             var roomlists = new List<Common.Room>();
             roomlists.Clear();
-            if (Config.Instance.Home.FloorDics.Count < 1)
+            if (Config.Instance.Home.FloorDics.Count < 2)
             {
                 foolrname.Visible = false;
                 dropdown.Visible = false;
@@ -364,7 +367,7 @@
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains));
             }
 
-            var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone);
+            var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone|| device.CommonDevice.Type == DeviceType.TemperatureSensor);
             if (iASZonejosn != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor));
@@ -484,6 +487,7 @@
                     else if (devicetype == Language.StringByID(MyInternationalizationString.sensor))
                     {
                         list.Add(DeviceType.IASZone);
+                        list.Add(DeviceType.TemperatureSensor);
                     }
                     else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock))
                     {
@@ -585,6 +589,21 @@
                             deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png";
 
 
+                        }
+                        break;
+                    case DeviceType.TemperatureSensor:
+                        {
+                            var temperatureSensor = common.CommonDevice as TemperatureSensor;
+                            if (temperatureSensor.SensorDiv == 1)
+                            {
+                                deviceIconBtn.UnSelectedImagePath = $"ZigeeLogic/temperature.png";
+                                deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedtemperature.png";
+                            }
+                            else
+                            {
+                                deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/humidity.png";
+                                deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedhumidity.png";
+                            }
                         }
                         break;
                     case DeviceType.OnOffSwitch:
@@ -1352,7 +1371,7 @@
                 case DeviceType.DoorLock:
                     {
                         #region  ------
-                        var doorlockifonlist = Send.ReadDoorLockIfon("ccccccfffe300347");
+                        var doorlockifonlist = Send.ReadDoorLockIfon(common.DeviceAddr);
                         //var list = Send.ReadDoorLockIfon(common.DeviceAddr);
                         var pra = new UserCenter.MemberListInfoPra();
                         string result = await UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
@@ -1395,6 +1414,91 @@
                     }
                     break;
 
+                case DeviceType.TemperatureSensor:
+                    {
+                        devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 2 - 20 - 50);
+                        devicefra.Height = Application.GetRealHeight(140 + 160 * 2 + 20 + 50);
+                        var temperatureSensor = common as TemperatureSensor;
+                        var Btntemperaturevalue = new Button
+                        {
+                            TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                            Height = Application.GetRealHeight(60),
+                            Width = Application.GetRealWidth(400),
+                            TextAlignment = TextAlignment.CenterLeft,
+                            X = Application.GetRealWidth(80),
+                            Y = timetype.Bottom + Application.GetRealHeight(70),
+                        };
+                        devicefra.AddChidren(Btntemperaturevalue);
+
+                        var horizontalSeekBarVol = new HorizontalSeekBar
+                        {
+                            Width = Application.GetRealWidth(920),
+                            Height = Application.GetRealHeight(80),
+                            Radius = (uint)Application.GetRealHeight(25),
+                            Y = timetype.Bottom + Application.GetRealHeight(70 + 60 + 70),
+                            X = Application.GetRealWidth(80),
+                            ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected,
+                            Max = 100,
+                            SleepTime = 1000,
+                            ThumbRadius = 9,
+                        };
+                        devicefra.AddChidren(horizontalSeekBarVol);
+                        horizontalSeekBarVol.MouseUpEventHandler += (sender, e) =>
+                        {
+                            SelectedDeviceStatuscondition = "TemperatureSensor";
+                            if (temperatureSensor.SensorDiv == 1)
+                            {
+                                dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString());
+
+                                Btntemperaturevalue.Text = "褰撳墠>" + horizontalSeekBarVol.Progress.ToString() + "鈩�";
+
+                            }
+                            else
+                            {
+                                Btntemperaturevalue.Text = "褰撳墠<" + horizontalSeekBarVol.Progress.ToString() + "%";
+                                dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString());//娓╁害鍊�
+                            }
+                        };
+
+
+
+                        if (temperatureSensor.SensorDiv == 1)
+                        {
+                            dictionary(deviceConditionsInfo, "Cluster_ID", "1026");
+                            dictionary(deviceConditionsInfo, "AttriButeId", "0");
+                            dictionary(deviceConditionsInfo, "Range", "0");//0澶т簬AttriButeData1鏃惰Е鍙戝姩浣�
+                            dictionary(deviceConditionsInfo, "AttriButeData1", "0");
+                            dictionary(deviceConditionsInfo, "AttriButeData2", "0");
+                            Btntemperaturevalue.Text = "褰撳墠>0鈩�";
+
+                        }
+                        else
+                        {
+                            Btntemperaturevalue.Text = "褰撳墠<0%";
+                            dictionary(deviceConditionsInfo, "Cluster_ID", "1029");
+                            dictionary(deviceConditionsInfo, "AttriButeId", "0");
+                            dictionary(deviceConditionsInfo, "Range", "2");//2灏忎簬AttriButeData1鏃惰Е鍙戝姩浣�
+                            dictionary(deviceConditionsInfo, "AttriButeData1", "0");//娓╁害鍊�
+                            dictionary(deviceConditionsInfo, "AttriButeData2", "0");
+                        }
+
+                        if (edit && devices != null)
+                        {
+                            horizontalSeekBarVol.Progress = int.Parse(devices["AttriButeData1"]);
+                            if (temperatureSensor.SensorDiv == 1)
+                            {
+
+                                Btntemperaturevalue.Text = "褰撳墠>" + devices["AttriButeData1"] + "鈩�";
+
+                            }
+                            else
+                            {
+                                Btntemperaturevalue.Text = "褰撳墠<" + devices["AttriButeData1"] + "%";
+                            }
+                        }
+
+                    }
+                    break;
             }
 
             Btncomplete.MouseUpEventHandler += (sender2, e2) =>

--
Gitblit v1.8.0