From d4811b7d34b45ff6b21b97f11da128b5572ec526 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 03 三月 2021 16:03:03 +0800
Subject: [PATCH] 20210303-1

---
 HDL-ON_Android/.DS_Store                                                          |    0 
 HDL-ON_Android/Properties/AndroidManifest.xml                                     |    2 
 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs            |    2 
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs  |  150 +------------
 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs                     |    2 
 HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs                  |  110 +++++++--
 HDL_ON/DAL/Mqtt/MqttClient.cs                                                     |    2 
 HDL_ON/HDL_ON.projitems                                                           |    1 
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs                                           |   20 +
 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs              |  168 +++++++++++++++
 HDL-ON_iOS/Info.plist                                                             |    4 
 HDL_ON/DAL/Server/NewAPI.cs                                                       |    8 
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs |   15 
 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs                       |   13 -
 .DS_Store                                                                         |    0 
 HDL_ON/DAL/Server/HttpServerRequest.cs                                            |   54 +++-
 .vs/HDL_APP_Project/xs/UserPrefs.xml                                              |   44 +--
 HDL_ON/UI/MainPage.cs                                                             |    2 
 HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs                          |   20 +
 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs                 |    5 
 20 files changed, 382 insertions(+), 240 deletions(-)

diff --git a/.DS_Store b/.DS_Store
index 08c846d..3d678e9 100644
--- a/.DS_Store
+++ b/.DS_Store
Binary files differ
diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 1de7a4f..bf727a7 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,53 +1,33 @@
 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
-  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs">
+  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" />
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs">
     <Files>
-      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionPage.cs" Line="1" Column="1" />
-      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionPageBLL.cs" Line="13" Column="56" />
-      <File FileName="HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs" Line="78" Column="52" />
-      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs" Line="340" Column="22" />
-      <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="743" Column="75" />
-      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="249" Column="69" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs" Line="152" Column="16" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs" Line="142" Column="51" />
       <File FileName="HDL_ON/UI/MainPage.cs" Line="29" Column="55" />
-      <File FileName="HDL-ON_iOS/Info.plist" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs" Line="340" Column="42" />
+      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" Line="432" Column="43" />
+      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" Line="242" Column="30" />
+      <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="863" Column="51" />
+      <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" Line="377" Column="49" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
         <State name="__root__">
           <Node name="HDL_APP_Project" expanded="True">
             <Node name="HDL_ON" expanded="True">
-              <Node name="Common" expanded="True" />
-              <Node name="DAL" expanded="True">
-                <Node name="DriverLayer" expanded="True" />
-                <Node name="Mqtt" expanded="True" />
-                <Node name="Server" expanded="True" />
-              </Node>
-              <Node name="Entity" expanded="True">
-                <Node name="Function" expanded="True" />
-              </Node>
               <Node name="UI" expanded="True">
-                <Node name="UI0-Stan" expanded="True" />
-                <Node name="UI1-Login" expanded="True" />
                 <Node name="UI2" expanded="True">
-                  <Node name="1-HomePage" expanded="True" />
-                  <Node name="2-Classification" expanded="True" />
-                  <Node name="3-Intelligence" expanded="True">
-                    <Node name="Automation" expanded="True">
-                      <Node name="ConditionDeviceFunList.cs" selected="True" />
-                    </Node>
+                  <Node name="1-HomePage" expanded="True">
+                    <Node name="HomePageBLL.cs" selected="True" />
                   </Node>
-                  <Node name="4-PersonalCenter" expanded="True" />
+                  <Node name="2-Classification" expanded="True" />
                   <Node name="FuntionControlView" expanded="True">
-                    <Node name="Curtain" expanded="True" />
                     <Node name="Electrical" expanded="True" />
                   </Node>
                 </Node>
               </Node>
             </Node>
-            <Node name="HDL-ON_iOS" expanded="True">
-              <Node name="Resources" expanded="True" />
-            </Node>
+            <Node name="HDL-ON_iOS" expanded="True" />
             <Node name="ys" expanded="True" />
           </Node>
         </State>
diff --git a/HDL-ON_Android/.DS_Store b/HDL-ON_Android/.DS_Store
index 14bc0b8..ec75957 100644
--- a/HDL-ON_Android/.DS_Store
+++ b/HDL-ON_Android/.DS_Store
Binary files differ
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index 2677841..3cc2844 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103021" android:versionName="1.1.202103021" package="com.hdl.onpro">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103031" android:versionName="1.1.202103031" package="com.hdl.onpro">
 	<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26" />
 	<!--  瀹氫綅鏉冮檺-->
 	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist
index 1d85f5e..6fbd3df 100644
--- a/HDL-ON_iOS/Info.plist
+++ b/HDL-ON_iOS/Info.plist
@@ -102,9 +102,9 @@
 	<key>UIStatusBarStyle</key>
 	<string>UIStatusBarStyleLightContent</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.1.202103021</string>
+	<string>1.1.202103031</string>
 	<key>CFBundleVersion</key>
-	<string>202103021</string>
+	<string>202103031</string>
 	<key>NSLocationWhenInUseUsageDescription</key>
 	<string>Use geographic location to provide services such as weather</string>
 	<key>NSAppleMusicUsageDescription</key>
diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index 2971c64..d6b5871 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -246,7 +246,7 @@
                             try
                             {
                                 var topic = e.ApplicationMessage.Topic;
-                                //MainPage.Log($"鏀跺埌mqtt涓婚:{topic}");
+                                MainPage.Log($"鏀跺埌mqtt涓婚:{topic}");
                                 //涓�绔彛涓婚澶勭悊
                                 if (DB_ResidenceData.Instance.GatewayType == 0 && !DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
                                 {
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 60aacf0..63a7ec2 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -37,34 +37,48 @@
         {
         }
 
+        #region kaede ___________浼犳劅鍣ㄥ巻鍙叉暟鎹甠_________________
         /// <summary>
         /// 鑾峰彇浼犳劅鍣ㄥ巻鍙叉暟鎹�
         /// </summary>
-        /// <param name="subnetId"></param>
-        /// <param name="deviceId"></param>
-        /// <param name="bigClass"></param>
-        /// <param name="minClass"></param>
-        /// <param name="queryType"></param>
-        /// <param name="loopId"></param>
-        /// <param name="nowMonth"></param>
-        /// <param name="mac"></param>
+        /// <param name="qType">鏃堕棿鏌ヨ绫诲瀷锛歨our=杩�24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈� </param>
+        /// <param name="deviceId">璁惧ID</param>
+        /// <param name="deviceKey">鍔熻兘鏌ヨ绫诲瀷锛歱m25</param>
         /// <returns></returns>
-        public ResponsePack GetSensorHistory(int subnetId, int deviceId, int bigClass, int minClass, int queryType, int loopId, int nowMonth, string mac)
+        public ResponsePackNew GetSensorHistory(string qType, string deviceId,string deviceKey)
         {
             Dictionary<string, object> d = new Dictionary<string, object>();
-            d.Add("SubnetID", subnetId);
-            d.Add("DeviceID", deviceId);
-            d.Add("LargeType", bigClass);
-            d.Add("SmallType", minClass);
-            d.Add("QueryType", queryType);
-            d.Add("loopId", loopId);
-            d.Add("NowMonth", nowMonth);
-            d.Add("MAC", DB_ResidenceData.Instance.residenceGatewayMAC);
-            d.Add("LocalTimeZone", 8);
-            var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-            return RequestHttps("https://developer.hdlcontrol.com/api/GetSensorPushHistory", jsonString, true);
+            d.Add("type", qType);
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+            d.Add("deviceId", new List<string>() { deviceId });
+            d.Add("key", new List<string>() { deviceKey });
 
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson);
         }
+        /// <summary>
+        /// 鑾峰彇瀹夐槻浼犳劅鍣ㄥ巻鍙叉暟鎹�
+        /// </summary>
+        /// <param name="deviceId">璁惧ID</param>
+        /// <param name="pageSize">椤甸潰澶у皬</param>
+        /// <param name="pageNo">椤靛彿</param>
+        /// <returns></returns>
+        public ResponsePackNew GetArmSensorHistory( string deviceId,string pageSize, string pageNo)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+            d.Add("deviceId", deviceId);
+            d.Add("pageSize", pageSize);
+            d.Add("pageNo", pageNo);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson);
+        }
+
+
+
+
+        #endregion
 
         //public string GetRequestResultMsg(string resultCode)
         //{
diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs
index 40517bf..f726e7d 100644
--- a/HDL_ON/DAL/Server/NewAPI.cs
+++ b/HDL_ON/DAL/Server/NewAPI.cs
@@ -357,6 +357,14 @@
         /// 鍙栨秷鏀惰棌璁惧
         /// </summary>
         public const string Api_Post_CancelCollectDevice = "/home-wisdom/app/device/cancelCollect";
+        /// <summary>
+        /// 鑾峰彇鐜浼犳劅鍣ㄥ巻鍙叉暟鎹� 灏忔椂/鍛�/鏈堢粺璁℃暟鎹�
+        /// </summary>
+        public const string Api_Post_EnvironmentalSensorHistoricalData = "/home-wisdom/app/statistics/device/hourWeekMonth";
+        /// <summary>
+        /// 鑾峰彇瀹夐槻浼犳劅鍣ㄥ巻鍙叉暟鎹�
+        /// </summary>
+        public const string Api_Post_ArmSensorHistoricalData = "/home-wisdom/app/device/message";
         #endregion
 
         #region Kaede -- 鍦烘櫙鎺ュ彛____________________________
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index 4294acf..58efc12 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -356,6 +356,7 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\FailView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\ReplicationView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\ClothesHangerSetTimePage.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\ArmSensorHistroyPaging.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)UI\" />
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 74cda7f..3a8d23e 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -26,7 +26,7 @@
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string VersionString = "1.1.0302";
+        public static string VersionString = "1.1.0303";
         ///// <summary>
         ///// 瀹㈡埛绔被鍨�
         ///// </summary>
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index c527412..c090e78 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -366,7 +366,15 @@
             };
             btnUp.MouseUpEventHandler = (sender, e) =>
             {
-                btnUp.IsSelected = false;
+                new System.Threading.Thread(() =>
+                {
+                    System.Threading.Thread.Sleep(2000);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnUp.IsSelected = false;
+                    });
+                })
+                { IsBackground = true }.Start();
                 function.SetAttrState(FunctionAttributeKey.Position, "up");
                 Dictionary<string, string> d = new Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.Position, "up");
@@ -379,7 +387,15 @@
             };
             btnDown.MouseUpEventHandler = (sender, e) =>
             {
-                btnDown.IsSelected = false;
+                new System.Threading.Thread(() =>
+                {
+                    System.Threading.Thread.Sleep(2000);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnDown.IsSelected = false;
+                    });
+                })
+                { IsBackground = true }.Start();
                 function.SetAttrState(FunctionAttributeKey.Position, "down");
                 Dictionary<string, string> d = new Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.Position, "down");
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
index 45dc658..692d673 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
@@ -234,7 +234,15 @@
             };
             btnUp.MouseUpEventHandler = (sender, e) =>
             {
-                btnUp.IsSelected = false;
+                new System.Threading.Thread(() =>
+                {
+                    System.Threading.Thread.Sleep(2000);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnUp.IsSelected = false;
+                    });
+                })
+                { IsBackground = true }.Start();
                 function.SetAttrState(FunctionAttributeKey.Position, "up");
                 Dictionary<string, string> d = new Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.Position, "up");
@@ -247,7 +255,15 @@
             };
             btnDown.MouseUpEventHandler = (sender, e) =>
             {
-                btnDown.IsSelected = false;
+                new System.Threading.Thread(() =>
+                {
+                    System.Threading.Thread.Sleep(2000);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnDown.IsSelected = false;
+                    });
+                })
+                { IsBackground = true }.Start();
                 function.SetAttrState(FunctionAttributeKey.Position, "down");
                 Dictionary<string, string> d = new Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.Position, "down");
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs
new file mode 100644
index 0000000..bd249f2
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs
@@ -0,0 +1,168 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.Entity;
+using HDL_ON.UI.CSS;
+using Shared;
+
+namespace HDL_ON.UI
+{
+    public class ArmSensorHistroyPaging
+    {
+        Function device;
+        public ArmSensorHistroyPaging(Function function)
+        {
+            device = function;
+        }
+
+        public void InitFrame(FrameLayout FrameWhiteCentet2)
+        {
+            Button btnTitle = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(220),
+                Height = Application.GetRealHeight(65),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                IsBold = true,
+                TextID = StringId.Log,
+            };
+            FrameWhiteCentet2.AddChidren(btnTitle);
+
+            VerticalScrolViewLayout histroyView = new VerticalScrolViewLayout()
+            {
+                Y = btnTitle.Bottom,
+                Height = Application.GetRealHeight(450),
+            };
+            FrameWhiteCentet2.AddChidren(histroyView);
+
+            var waitPage = new Loading();
+            FrameWhiteCentet2.AddChidren(waitPage);
+            waitPage.Start(Language.StringByID(StringId.PleaseWait));
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    int pageCount = 1;
+                    var pm = new DAL.Server.HttpServerRequest();
+                    var pack = pm.GetArmSensorHistory(device.deviceId, "20", "1");
+                    var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud_ArmSensorHistory>(pack.Data.ToString());
+                    List<string> years = new List<string>();
+                    Application.RunOnMainThread(() =>
+                    {
+                        var startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯
+                        foreach (var data in revData.list)
+                        {
+                            var yearString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("yyyy") + Language.StringByID(StringId.Years);
+                            var monthString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("m");
+                            var timeString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("HH:mm:ss");
+                            var dateString = monthString + " " + timeString;
+                            if (!years.Contains(yearString))
+                            {
+                                years.Add(yearString);
+                                Button btnYear = new Button()
+                                {
+                                    X = Application.GetRealWidth(16),
+                                    Height = Application.GetRealHeight(46),
+                                    Width = Application.GetRealWidth(220),
+                                    TextAlignment = TextAlignment.CenterLeft,
+                                    TextSize = CSS_FontSize.SubheadingFontSize,
+                                    TextColor = CSS_Color.FirstLevelTitleColor,
+                                    IsBold = true,
+                                    Text = yearString,
+                                };
+                                histroyView.AddChidren(btnYear);
+                            }
+                            var cell = new ArmSensorHistoryMsgCell()
+                            {
+                                Height = Application.GetRealHeight(50),
+                            };
+                            histroyView.AddChidren(cell);
+                            cell.InitControl(data.content, dateString);
+                        }
+                    });
+                }
+                catch
+                {
+
+                }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        waitPage.Hide();
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+    }
+
+    public class ArmSensorHistoryMsgCell : FrameLayout
+    {
+        Button btnMsg;
+        Button btnTime;
+
+        public void InitControl(string msg, string time)
+        {
+            btnMsg = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                Height = Application.GetRealHeight(40),
+                Width = Application.GetRealWidth(300),
+                //Width = Application.GetRealWidth(220),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                Text = msg,
+            };
+            this.AddChidren(btnMsg);
+
+            btnTime = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(35),
+                Width = Application.GetRealWidth(295),
+                //Width = Application.GetRealWidth(80),
+                Height = Application.GetRealHeight(15),
+                TextAlignment = TextAlignment.CenterRight,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextColor = CSS_Color.PromptingColor1,
+                Text = time,
+                IsMoreLines = true
+            };
+            this.AddChidren(btnTime);
+
+            AddChidren(new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(49),
+                Width = Application.GetRealWidth(295),
+                Height = 1,
+                BackgroundColor = CSS_Color.DividingLineColor,
+            });
+        }
+
+
+    }
+
+    /// <summary>
+    /// 浜戠api鎺ュ彛杩斿洖鐨勫畨闃蹭紶鎰熷櫒鍘嗗彶鏁版嵁瀵硅薄
+    /// </summary>
+    public class Cloud_ArmSensorHistory
+    {
+        public string totalCount = "";
+        public string totalPage = "";
+        public string pageNo = "";
+        public string pageSize = "";
+        public List<ArmSensorHistory> list = new List<ArmSensorHistory>();
+    }
+
+    public class ArmSensorHistory
+    {
+        public string title = "";
+        public string content = "";
+        public string level = "";
+        public string createTime = "";
+    }
+}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs
index 65c7aa3..b2627e1 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs
@@ -2,6 +2,8 @@
 using HDL_ON.Stan;
 using HDL_ON.UI.CSS;
 using HDL_ON.Entity;
+using System.Collections.Generic;
+using System;
 
 namespace HDL_ON.UI
 {
@@ -79,6 +81,8 @@
         /// </summary>
         private void InitFrameWhiteContent2()
         {
+            var paging = new ArmSensorHistroyPaging(device);
+            paging.InitFrame(FrameWhiteCentet2);
         }
 
         #endregion
@@ -167,4 +171,5 @@
 
         #endregion
     }
+
 }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs
index d525651..a1815aa 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs
@@ -81,17 +81,8 @@
         /// </summary>
         private void InitFrameWhiteContent2()
         {
-            Button btnLog = new Button()
-            {
-                X = Application.GetRealWidth(16),
-                Y = Application.GetRealHeight(16),
-                Width = Application.GetRealWidth(250),
-                Height = Application.GetRealHeight(33),
-                TextAlignment = TextAlignment.CenterLeft,
-                IsBold = true,
-                TextID = StringId.Log,
-            };
-            FrameWhiteCentet2.AddChidren(btnLog);
+            var paging = new ArmSensorHistroyPaging(device);
+            paging.InitFrame(FrameWhiteCentet2);
         }
 
         #endregion
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs
index c1fbef7..720eab6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs
@@ -79,6 +79,8 @@
         /// </summary>
         private void InitFrameWhiteContent2()
         {
+            var paging = new ArmSensorHistroyPaging(device);
+            paging.InitFrame(FrameWhiteCentet2);
         }
 
         #endregion
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs
index 6c1071e..4d2af1d 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs
@@ -79,6 +79,8 @@
         /// </summary>
         private void InitFrameWhiteContent2()
         {
+            var paging = new ArmSensorHistroyPaging(device);
+            paging.InitFrame(FrameWhiteCentet2);
         }
 
         #endregion
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
index fa00457..6454ccb 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
@@ -126,6 +126,62 @@
             };
             FrameWhiteCentet1.AddChidren(btnDown);
 
+            #region 鎺у埗
+            btnUp.MouseDownEventHandler = (sender, e) => {
+                btnUp.IsSelected = true;
+            };
+            btnUp.MouseUpEventHandler = (sender, e) => {
+                new System.Threading.Thread(() =>
+                {
+                    System.Threading.Thread.Sleep(2000);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnUp.IsSelected = false;
+                    });
+                })
+                { IsBackground = true }.Start();
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.Position, "up");
+                Control.Ins.SendWriteCommand(device, d);
+            };
+            //----
+            btnStop.MouseDownEventHandler = (sender, e) => {
+                btnStop.IsSelected = true;
+            };
+            btnStop.MouseUpEventHandler = (sender, e) => {
+                new System.Threading.Thread(() =>
+                {
+                    System.Threading.Thread.Sleep(2000);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnStop.IsSelected = false;
+                    });
+                })
+                { IsBackground = true }.Start();
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.Position, "stop");
+                Control.Ins.SendWriteCommand(device, d);
+            };
+            //-----
+            btnDown.MouseDownEventHandler = (sender, e) => {
+                btnDown.IsSelected = true;
+            };
+            btnDown.MouseUpEventHandler = (sender, e) => {
+                new System.Threading.Thread(() =>
+                {
+                    System.Threading.Thread.Sleep(2000);
+                    Application.RunOnMainThread(() =>
+                    {
+                        btnDown.IsSelected = false;
+                    });
+                })
+                { IsBackground = true }.Start();
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.Position, "down");
+                Control.Ins.SendWriteCommand(device, d);
+            };
+            #endregion
+
             #endregion
 
             #region 鑿滃崟
@@ -152,7 +208,8 @@
             {
                 FrameWhiteCentet1.AddChidren(hotDryView);
 
-                EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
+                EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+                {
                     string onoff = hotDryView.Lighting ? "false" : "true";
                     device.SetAttrState(FunctionAttributeKey.HotDry, onoff);
                     Dictionary<string, string> d = new Dictionary<string, string>();
@@ -174,13 +231,14 @@
             windDryView.Height = Application.GetRealHeight(74);
             if (attrs.Contains(menu[1]))
             {
-                if(index == 1)
+                if (index == 1)
                 {
                     windDryView.Gravity = Gravity.CenterHorizontal;
                 }
                 FrameWhiteCentet1.AddChidren(windDryView);
 
-                EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
+                EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+                {
                     string onoff = windDryView.Lighting ? "false" : "true";
                     device.SetAttrState(FunctionAttributeKey.WindDry, onoff);
                     Dictionary<string, string> d = new Dictionary<string, string>();
@@ -192,7 +250,7 @@
                 index++;
             }
 
-            
+
 
             disinfectView = new ClothesHangerControl(
                                 "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDisinfectIcon.png",
@@ -204,7 +262,7 @@
             disinfectView.Height = Application.GetRealHeight(74);
             if (attrs.Contains(menu[2]))
             {
-                if(index == 1)
+                if (index == 1)
                 {
                     disinfectView.Gravity = Gravity.CenterHorizontal;
                 }
@@ -214,7 +272,8 @@
                 }
                 FrameWhiteCentet1.AddChidren(disinfectView);
 
-                EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
+                EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+                {
                     string onoff = disinfectView.Lighting ? "false" : "true";
                     device.SetAttrState(FunctionAttributeKey.Disinfect, onoff);
                     Dictionary<string, string> d = new Dictionary<string, string>();
@@ -235,10 +294,11 @@
             lightingView.Height = Application.GetRealHeight(74);
             if (attrs.Contains(menu[3]))
             {
-                if(index >2)
+                if (index > 2)
                 {
                     lightingView.Y = Application.GetRealHeight(409);
-                }else
+                }
+                else
                 {
                     lightingView.Y = Application.GetRealHeight(304);
                     if (index == 1)
@@ -252,7 +312,8 @@
                 }
                 FrameWhiteCentet1.AddChidren(lightingView);
 
-                EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
+                EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+                {
                     string onoff = lightingView.Lighting ? "off" : "on";
                     device.SetAttrState(FunctionAttributeKey.OnOff, onoff);
                     Dictionary<string, string> d = new Dictionary<string, string>();
@@ -324,7 +385,8 @@
         /// </summary>
         private void RefreshFormStatu()
         {
-            Application.RunOnMainThread(() => {
+            Application.RunOnMainThread(() =>
+            {
                 btnIcon.IsSelected = true;
                 #region 鐐逛寒鏂囨湰
                 var hotDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDry);
@@ -360,7 +422,7 @@
                 if (windDryTimeLeftTemp != null)
                 {
                     windDryView.ChangeTime(windDryTimeLeftTemp.value);
-                    MainPage.Log($"椋庡共鍓╀綑鏃堕棿{windDryTimeLeftTemp.value}"); 
+                    MainPage.Log($"椋庡共鍓╀綑鏃堕棿{windDryTimeLeftTemp.value}");
                 }
                 var disinfectTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft);
                 if (disinfectTimeLeftTemp != null)
@@ -407,9 +469,9 @@
         /// </summary>
         public bool Lighting = false;
 
-        
 
-        public ClothesHangerControl(string iconPath1, string iconPath2,string title,string time)
+
+        public ClothesHangerControl(string iconPath1, string iconPath2, string title, string time)
         {
             btnIcon = new Button()
             {
@@ -448,16 +510,17 @@
         /// 淇敼鏄剧ず鏃堕棿
         /// </summary>
         /// <param name="newTime"></param>
-        public void ChangeTime (string newTime)
+        public void ChangeTime(string newTime)
         {
             int.TryParse(newTime, out leftTime);
             leftTime *= 60;
             if (countdownThread == null)
             {
-                countdownThread = new System.Threading.Thread(() => {
-                    while(true)
+                countdownThread = new System.Threading.Thread(() =>
+                {
+                    while (true)
                     {
-                        if(leftTime > 1)
+                        if (leftTime > 1)
                         {
                             Application.RunOnMainThread(() =>
                             {
@@ -465,7 +528,8 @@
                             });
                             System.Threading.Thread.Sleep(1000);
                             leftTime--;
-                        }else
+                        }
+                        else
                         {
                             Application.RunOnMainThread(() =>
                             {
@@ -473,7 +537,8 @@
                             });
                         }
                     }
-                }) { IsBackground = true };
+                })
+                { IsBackground = true };
                 countdownThread.Start();
             }
         }
@@ -481,11 +546,6 @@
         public void SetViewStatus(bool state)
         {
             btnIcon.IsSelected = btnTitle.IsSelected = btnTime.IsSelected = Lighting = state;
-        }
-
-        public bool GetViewState()
-        {
-            return Lighting;
         }
 
         /// <summary>
@@ -503,4 +563,4 @@
         /// </summary>
         System.Threading.Thread countdownThread;
     }
-}
+}
\ No newline at end of file
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs
index 5ca34c0..cbd8d7e 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs
@@ -285,10 +285,6 @@
 
             #region 鎴块棿椤堕儴鍒囨崲鏄剧ず鍖哄煙
             room = new Room() { roomName = Language.StringByID(StringId.All)};
-            //if (DB_ResidenceData.rooms.Count > 0)
-            //{
-            //    room = DB_ResidenceData.rooms[0];
-            //}
             btnFoorDownIcon = new Button()
             {
                 Width = Application.GetMinRealAverage(16),
@@ -418,12 +414,11 @@
                 };
                 sensorView.AddChidren(btnSensorTitle);
                 btnSensorTitle.MouseUpEventHandler = (sender, e) => {
-                    return;
-                    #region F3闃舵
-                    //var esp = new EnvironmentalSensorPage(sensor);
-                    //MainPage.BasePageView.AddChidren(esp);
-                    //esp.LoadPage();
-                    //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    #region 
+                    var esp = new EnvironmentalSensorPage(sensor);
+                    MainPage.BasePageView.AddChidren(esp);
+                    esp.LoadPage();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                     #endregion
                 };
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
index 0770c48..594196b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
@@ -27,7 +27,7 @@
         /// <summary>
         /// 褰撳墠鏌ヨ绫诲瀷
         /// </summary>
-        QueryType curQueryType = QueryType.NowDay;
+        string curQueryType = "hour";
 
         List<uint> tipColorList = new List<uint>()
         {
@@ -801,14 +801,6 @@
     //------------
     public partial class EnvironmentalSensorPage
     {
-       public  enum QueryType
-        {
-            NowDay = 0,//褰撳ぉ
-            NowMonth = 1,//鎸囧畾鏈�
-            NowYear = 2,//浠婂勾
-            LatelySevenDay = 3//鏈�杩戜竷澶�
-        }
-
         /// <summary>
         /// 璇诲彇浼犳劅鍣ㄥ巻鍙叉暟鎹�
         /// </summary>
@@ -830,69 +822,8 @@
                     Application.RunOnMainThread(() => {
                         loadPage.Start(Language.StringByID(StringId.PleaseWait));
                     });
-                    var curMonth = 0;
-                    if(curQueryType == QueryType.NowMonth)
-                    {
-                        curMonth = DateTime.Now.Month;
-                    }
                     int i = 0;
-
-//#if DEBUG
-//                    var sItem = new EchartSeriesItem
-//                    {
-//                        name = sensor.GetRoomListName(),
-//                        data = new List<int>(),
-//                        lineStyle = new EchartLineStyle()
-//                        {
-//                            color = tipColorStringList[i],
-//#if __IOS__
-//                            width = 5,
-//#elif __ANDROID__
-//                                        width = 2,
-//#endif
-//                        },
-//                    };
-//                    Random random = new Random();
-//                    double level = 0.0;
-//                    int countddd = 24;
-//                    for (int j = 0; j < countddd; j++)
-//                    {
-//                        switch (sensor.functionType)
-//                        {
-//                            case SPK.SensorPm25:
-//                                level = Math.Round(random.NextDouble() * 130, 0);
-//                                break;
-//                            case SPK.SensorCO2:
-//                                level = Math.Round(random.NextDouble() * 6000, 0);
-//                                break;
-//                            case SPK.SensorTemperature:
-//                                level = Math.Round(random.NextDouble() * 40, 0);
-//                                break;
-//                            case SPK.SensorTVOC:
-//                                level = Math.Round(random.NextDouble() * 10, 1);
-//                                break;
-//                            case SPK.SensorHumidity:
-//                                level = Math.Round(random.NextDouble() * 100, 0);
-//                                break;
-//                        }
-//                        sItem.data.Add((int)level);
-//                    }
-//                        seriesList.Add(sItem);
-//                    echartRootJson.series = seriesList;
-//#if __IOS__
-//                    echartRootJson.xAxis.axisLabel.fontSize = 22;
-//                    echartRootJson.yAxis.axisLabel.fontSize = 22;
-//#else
-//                    echartRootJson.xAxis.axisLabel.fontSize = 8;
-//                    echartRootJson.yAxis.axisLabel.fontSize = 8;
-//#endif
-//                    echartRootJsonString = Newtonsoft.Json.JsonConvert.SerializeObject(echartRootJson);
-//                    Application.RunOnMainThread(() =>
-//                    {
-//                        myEchartsView.ShowWithOptionJsonString(echartRootJsonString);
-//                    });
-//#endif
-
+      
                     foreach (var sr in FunctionList.List.sensorsEnvironmentalScience)
                     {
                         if (sr.spk != sensor.spk)
@@ -905,34 +836,14 @@
                             continue;
                         }
 
-                        byte sensorType = 0;
-                        switch (sr.spk)
-                        {
-                            case SPK.SensorTemperature:
-                                sensorType = 2;
-                                break;
-                            case SPK.SensorHumidity:
-                                sensorType = 3;
-                                break;
-                            case SPK.SensorTVOC:
-                                sensorType = 5;
-                                break;
-                            case SPK.SensorPm25:
-                                sensorType = 6;
-                                break;
-                            case SPK.SensorCO2:
-                                sensorType = 7;
-                                break;
-                        }
-                        var revertObj = new HttpServerRequest().GetSensorHistory(sr.bus.SubnetID, sr.bus.DeviceID,
-                               5, sensorType, (int)curQueryType, sr.bus.LoopId, curMonth,
-                               DB_ResidenceData.Instance.residenceGatewayMAC);
+                        var sensorType = sr.spk.Split(".")[0];
+                        var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, sr.deviceId,sensorType);
 
                         if (revertObj != null)
                         {
-                            if (revertObj.StateCode == StateCode.SUCCESS)
+                            if (revertObj.Code == StateCode.SUCCESS)
                             {
-                                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SensorPushHistoryRes>>(revertObj.ResponseData.ToString());
+                                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString());
 
                                 var sItem = new EchartSeriesItem
                                 {
@@ -949,34 +860,10 @@
                                     },
                                 };
 
-                                int ass = 0;
-                                for (int j = 0; j < revertData.Count; j++)
+                                foreach (var d in revertData)
                                 {
-                                    if (curQueryType == QueryType.NowMonth && revertData[j].CreatedOnUtc.Day > DateTime.Now.Day)
-                                    {
-                                        continue;
-                                    }
-                                    if (revertData[j].TargetValue.ToString() != "NaN")
-                                    {
-                                        ass = Convert.ToInt32(revertData[j].TargetValue);
-                                    }
-                                    else
-                                    {
-                                        ass = 0;
-                                    }
-                                    sItem.data.Add(ass);
-                                    switch (curQueryType)
-                                    {
-                                        case QueryType.NowDay:
-                                            echartRootJson.xAxis.data.Add(revertData[j].CreatedOnUtc.Hour.ToString());
-                                            break;
-                                        case QueryType.LatelySevenDay:
-                                            echartRootJson.xAxis.data.Add(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(revertData[j].CreatedOnUtc.DayOfWeek));
-                                            break;
-                                        case QueryType.NowMonth:
-                                            echartRootJson.xAxis.data.Add(revertData[j].CreatedOnUtc.Day.ToString());
-                                            break;
-                                    }
+                                    echartRootJson.xAxis.data.Add(d.fieldName);
+                                    echartRootJson.yAxis.data.Add(d.fieldValue);
                                 }
                                 seriesList.Add(sItem);
                             }
@@ -1030,7 +917,7 @@
                 btnShowHistroyData_Day.IsSelected = true;
                 btnShowHistroyData_Month.IsSelected = false;
                 btnShowHistroyData_Week.IsSelected = false;
-                curQueryType = QueryType.NowDay;
+                curQueryType = "hour";
                 LoadMothed_GetSensorHistoryData();
             };
 
@@ -1040,7 +927,7 @@
                 btnShowHistroyData_Day.IsSelected = false;
                 btnShowHistroyData_Month.IsSelected = true;
                 btnShowHistroyData_Week.IsSelected = false;
-                curQueryType = QueryType.NowMonth;
+                curQueryType = "week";
                 LoadMothed_GetSensorHistoryData();
             };
             btnShowHistroyData_Week.MouseUpEventHandler = (sender, e) =>
@@ -1049,7 +936,7 @@
                 btnShowHistroyData_Day.IsSelected = false;
                 btnShowHistroyData_Month.IsSelected = false;
                 btnShowHistroyData_Week.IsSelected = true;
-                curQueryType = QueryType.LatelySevenDay;
+                curQueryType = "month";
                 LoadMothed_GetSensorHistoryData();
             };
 
@@ -1061,17 +948,14 @@
         }
     }
 
-    public class SensorPushHistoryRes
+    public class EnvironmentalSensorHistor
     {
+        /// <summary>
+        /// </summary>
+        public string fieldName { get; set; }
 
         /// <summary>
-        /// 瀹為檯鐩爣鍊�
         /// </summary>
-        public float TargetValue { get; set; }
-
-        /// <summary>
-        /// 鏌ヨ鐨勬椂闂撮泦缇�
-        /// </summary>
-        public DateTime CreatedOnUtc { get; set; }
+        public string fieldValue { get; set; }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0