| | |
| | | <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> |
| | |
| | | <?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" /> |
| | |
| | | <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> |
| | |
| | | try |
| | | { |
| | | var topic = e.ApplicationMessage.Topic; |
| | | //MainPage.Log($"收到mqtt主题:{topic}"); |
| | | MainPage.Log($"收到mqtt主题:{topic}"); |
| | | //一端口主题处理 |
| | | if (DB_ResidenceData.Instance.GatewayType == 0 && !DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull()) |
| | | { |
| | |
| | | { |
| | | } |
| | | |
| | | #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) |
| | | //{ |
| | |
| | | /// 取消收藏设备 |
| | | /// </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 -- 场景接口____________________________ |
| | |
| | | <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\" />
|
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string VersionString = "1.1.0302"; |
| | | public static string VersionString = "1.1.0303"; |
| | | ///// <summary> |
| | | ///// 客户端类型 |
| | | ///// </summary> |
| | |
| | | }; |
| | | 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"); |
| | |
| | | }; |
| | | 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"); |
| | |
| | | }; |
| | | 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"); |
| | |
| | | }; |
| | | 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"); |
New file |
| | |
| | | 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 = ""; |
| | | } |
| | | } |
| | |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Entity; |
| | | using System.Collections.Generic; |
| | | using System; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | var paging = new ArmSensorHistroyPaging(device); |
| | | paging.InitFrame(FrameWhiteCentet2); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | } |
| | |
| | | /// </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 |
| | |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | var paging = new ArmSensorHistroyPaging(device); |
| | | paging.InitFrame(FrameWhiteCentet2); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | var paging = new ArmSensorHistroyPaging(device); |
| | | paging.InitFrame(FrameWhiteCentet2); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | }; |
| | | 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 菜单 |
| | |
| | | { |
| | | 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>(); |
| | |
| | | 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>(); |
| | |
| | | index++; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | disinfectView = new ClothesHangerControl( |
| | | "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDisinfectIcon.png", |
| | |
| | | disinfectView.Height = Application.GetRealHeight(74); |
| | | if (attrs.Contains(menu[2])) |
| | | { |
| | | if(index == 1) |
| | | if (index == 1) |
| | | { |
| | | disinfectView.Gravity = Gravity.CenterHorizontal; |
| | | } |
| | |
| | | } |
| | | 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>(); |
| | |
| | | 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) |
| | |
| | | } |
| | | 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>(); |
| | |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | #region 点亮文本 |
| | | var hotDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDry); |
| | |
| | | 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) |
| | |
| | | /// </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() |
| | | { |
| | |
| | | /// 修改显示时间 |
| | | /// </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(() => |
| | | { |
| | |
| | | }); |
| | | System.Threading.Thread.Sleep(1000); |
| | | leftTime--; |
| | | }else |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | }); |
| | | } |
| | | } |
| | | }) { IsBackground = true }; |
| | | }) |
| | | { IsBackground = true }; |
| | | countdownThread.Start(); |
| | | } |
| | | } |
| | |
| | | public void SetViewStatus(bool state) |
| | | { |
| | | btnIcon.IsSelected = btnTitle.IsSelected = btnTime.IsSelected = Lighting = state; |
| | | } |
| | | |
| | | public bool GetViewState() |
| | | { |
| | | return Lighting; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | System.Threading.Thread countdownThread; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | #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), |
| | |
| | | }; |
| | | 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 |
| | | }; |
| | | |
| | |
| | | /// <summary> |
| | | /// 当前查询类型 |
| | | /// </summary> |
| | | QueryType curQueryType = QueryType.NowDay; |
| | | string curQueryType = "hour"; |
| | | |
| | | List<uint> tipColorList = new List<uint>() |
| | | { |
| | |
| | | //------------ |
| | | public partial class EnvironmentalSensorPage |
| | | { |
| | | public enum QueryType |
| | | { |
| | | NowDay = 0,//当天 |
| | | NowMonth = 1,//指定月 |
| | | NowYear = 2,//今年 |
| | | LatelySevenDay = 3//最近七天 |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取传感器历史数据 |
| | | /// </summary> |
| | |
| | | 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) |
| | |
| | | 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 |
| | | { |
| | |
| | | }, |
| | | }; |
| | | |
| | | 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); |
| | | } |
| | |
| | | btnShowHistroyData_Day.IsSelected = true; |
| | | btnShowHistroyData_Month.IsSelected = false; |
| | | btnShowHistroyData_Week.IsSelected = false; |
| | | curQueryType = QueryType.NowDay; |
| | | curQueryType = "hour"; |
| | | LoadMothed_GetSensorHistoryData(); |
| | | }; |
| | | |
| | |
| | | btnShowHistroyData_Day.IsSelected = false; |
| | | btnShowHistroyData_Month.IsSelected = true; |
| | | btnShowHistroyData_Week.IsSelected = false; |
| | | curQueryType = QueryType.NowMonth; |
| | | curQueryType = "week"; |
| | | LoadMothed_GetSensorHistoryData(); |
| | | }; |
| | | btnShowHistroyData_Week.MouseUpEventHandler = (sender, e) => |
| | |
| | | btnShowHistroyData_Day.IsSelected = false; |
| | | btnShowHistroyData_Month.IsSelected = false; |
| | | btnShowHistroyData_Week.IsSelected = true; |
| | | curQueryType = QueryType.LatelySevenDay; |
| | | curQueryType = "month"; |
| | | LoadMothed_GetSensorHistoryData(); |
| | | }; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | 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; } |
| | | } |
| | | } |