wei
2021-03-03 d4811b7d34b45ff6b21b97f11da128b5572ec526
20210303-1

凉霸,
传感器日志
1个文件已添加
19个文件已修改
622 ■■■■■ 已修改文件
.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Properties/AndroidManifest.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Info.plist 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpServerRequest.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewAPI.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/MainPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs 168 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs 110 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs 150 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.DS_Store
Binary files differ
.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>
HDL-ON_Android/.DS_Store
Binary files differ
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" />
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>
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())
                                {
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">时间查询类型:hour=近24小时、week=近一周、month = 近一月 </param>
        /// <param name="deviceId">设备ID</param>
        /// <param name="deviceKey">功能查询类型:pm25</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)
        //{
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 -- 场景接口____________________________
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\" />
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>
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");
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");
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs
New file
@@ -0,0 +1,168 @@
using 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 = "";
    }
}
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
    }
}
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
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
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
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;
    }
}
}
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
                };
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; }
    }
}