From 557c8c4f75aafc97533721766272410042440d34 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期六, 21 八月 2021 11:00:29 +0800 Subject: [PATCH] 安防功能 --- HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 48 HDL-ON_iOS/HDL-ON_iOS.csproj | 2 HDL_ON/Common/ApiUtlis.cs | 8 HDL_ON/Entity/Function/SecurityAlarm.cs | 270 ++++ HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs | 119 + HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs | 441 +++++++ HDL_ON/HDL_ON.projitems | 4 HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs | 11 HDL-ON_Android/HDL-ON_Android.csproj | 2 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 27 HDL-ON_iOS/Resources/Language.ini | 11 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputSettingPage.cs | 995 ++++++++++++++++ .vs/HDL_APP_Project/xs/UserPrefs.xml | 66 HDL_ON/DAL/DriverLayer/Control.cs | 41 HDL_ON/UI/MainPage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs | 388 ++++++ HDL_ON/Entity/Function/Scene.cs | 13 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs | 1 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 1 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 6 HDL_ON/Entity/DB_ResidenceData.cs | 7 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 7 HDL_ON/Entity/FunctionList.cs | 9 HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL-ON_Android/Assets/Phone/Collection/DefenseStatusIcon.png | 0 HDL-ON_iOS/Resources/Phone/Collection/DisarmStatusIcon.png | 0 HDL-ON_Android/Assets/Phone/Collection/DisarmStatusIcon.png | 0 HDL_ON/Common/R.cs | 23 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs | 532 +++++--- HDL-ON_iOS/Resources/Phone/Collection/DefenseStatusIcon.png | 0 HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs | 2 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs | 627 ++++++++++ 33 files changed, 3,352 insertions(+), 317 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 70db16e..d959bc6 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,12 +1,21 @@ 锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> - <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.220222E9-B9CA-4834-9318-2BC22465F050" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs"> + <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/Server/HttpUtil.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs" Line="66" Column="23" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs" Line="217" Column="1" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" Line="114" Column="55" /> - <File FileName="HDL_ON/Common/R.cs" Line="10" Column="47" /> - <File FileName="HDL-ON_iOS/Resources/Language.ini" Line="479" Column="30" /> + <File FileName="HDL_ON/Entity/Function/Scene.cs" Line="83" Column="23" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs" Line="376" Column="33" /> + <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="392" Column="53" /> + <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" Line="28" Column="22" /> + <File FileName="HDL_ON/DAL/DriverLayer/UdpSocket.cs" Line="123" Column="1" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs" Line="199" Column="1" /> + <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="789" Column="18" /> + <File FileName="HDL_ON/DAL/Server/HttpServerRequest.cs" Line="2295" Column="32" /> + <File FileName="HDL_ON/DAL/Server/NewAPI.cs" Line="483" Column="23" /> + <File FileName="HDL_ON/Entity/FunctionList.cs" Line="179" Column="48" /> + <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="394" Column="1" /> + <File FileName="HDL_ON/Entity/Function/SecurityAlarm.cs" Line="72" Column="1" /> + <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="79" Column="28" /> + <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="22" Column="87" /> </Files> <Pads> <Pad Id="ProjectPad"> @@ -16,40 +25,18 @@ <Node name="Common" expanded="True" /> <Node name="DAL" expanded="True"> <Node name="DriverLayer" expanded="True" /> - <Node name="Server" expanded="True" /> + <Node name="Server" expanded="True"> + <Node name="HttpUtil.cs" selected="True" /> + </Node> </Node> <Node name="Entity" expanded="True"> <Node name="Function" expanded="True" /> </Node> <Node name="UI" 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="4-PersonalCenter" expanded="True"> - <Node name="AddFunction" expanded="True" /> - <Node name="FaceManagement" expanded="True"> - <Node name="FacePassagePage.cs" selected="True" /> - </Node> - <Node name="PirDevice" expanded="True" /> - <Node name="RoomListManage" expanded="True" /> - </Node> <Node name="FuntionControlView" expanded="True"> <Node name="ArmCenter" expanded="True" /> - <Node name="Light" expanded="True" /> - </Node> - </Node> - </Node> - </Node> - <Node name="HDL-ON_Android" expanded="True"> - <Node name="Assets" expanded="True"> - <Node name="Phone" expanded="True"> - <Node name="FunctionIcon" expanded="True"> - <Node name="Light" expanded="True" /> - </Node> - <Node name="PersonalCenter" expanded="True"> - <Node name="FacePassage" expanded="True" /> </Node> </Node> </Node> @@ -57,13 +44,7 @@ <Node name="HDL-ON_iOS" expanded="True"> <Node name="Resources" expanded="True"> <Node name="Phone" expanded="True"> - <Node name="FunctionIcon" expanded="True"> - <Node name="Light" expanded="True"> - <Node name="LightScene" expanded="True" /> - </Node> - </Node> - <Node name="PersonalCenter" expanded="True" /> - <Node name="Public" expanded="True" /> + <Node name="Collection" expanded="True" /> </Node> </Node> </Node> @@ -78,17 +59,20 @@ <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" line="42" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Common/ApiUtlis.cs" relfile="HDL_ON/Common/ApiUtlis.cs" line="390" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="422" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="747" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferUserConfirmPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferUserConfirmPage.cs" line="106" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="348" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddDevciePage.cs" line="54" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2318" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" line="168" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs" line="424" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="785" column="1" /> </BreakpointStore> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> diff --git a/HDL-ON_Android/Assets/Phone/Collection/DefenseStatusIcon.png b/HDL-ON_Android/Assets/Phone/Collection/DefenseStatusIcon.png new file mode 100644 index 0000000..6fa5bd1 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/Collection/DefenseStatusIcon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/Collection/DisarmStatusIcon.png b/HDL-ON_Android/Assets/Phone/Collection/DisarmStatusIcon.png new file mode 100644 index 0000000..da8a843 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/Collection/DisarmStatusIcon.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index aa13318..b89fd18 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -440,6 +440,8 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\CheckIcon.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\CheckOnIcon.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\SetLightSceneIcon.png" /> + <AndroidAsset Include="Assets\Phone\Collection\DefenseStatusIcon.png" /> + <AndroidAsset Include="Assets\Phone\Collection\DisarmStatusIcon.png" /> </ItemGroup> <ItemGroup> <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\BindScene.png" /> diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index 659e1ff..907983d 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="202108171" android:versionName="1.2.202108171" package="com.hdl.onpro"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202108201" android:versionName="1.2.202108201" package="com.hdl.onpro"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> <!-- 涔愭鍙瀵硅闇�瑕佺殑鏉冮檺 --> <!--<uses-permission android:name="android.permission.INTERNET" />--> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 6f1d223..2e079e1 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1328,6 +1328,8 @@ <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\AddTargetIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\RightIcon.png" /> <BundleResource Include="Resources\Phone\PersonalCenter\FacePassage\FaceIcon.png" /> + <BundleResource Include="Resources\Phone\Collection\DefenseStatusIcon.png" /> + <BundleResource Include="Resources\Phone\Collection\DisarmStatusIcon.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 01ffbc4..a2c3ac7 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -481,7 +481,11 @@ 493=Reset face ID 494=Set face ID 495=Face passage settings - +496=There is no associated task deployment status +497=Custom +498=Trigger delay +499=Add defense function +500=Add alarm target 1000=Room Humidity @@ -1572,6 +1576,11 @@ 493=閲嶇疆闈㈠ 494=璁剧疆闈㈠ 495=浜鸿劯閫氳璁剧疆 +496=杩樻病鏈夊叧鑱斾换浣曞竷闃茬姸鎬� +497=鑷畾涔� +498=瑙﹀彂寤舵椂 +499=娣诲姞甯冮槻鍔熻兘 +500=娣诲姞鍛婅鐩爣 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL-ON_iOS/Resources/Phone/Collection/DefenseStatusIcon.png b/HDL-ON_iOS/Resources/Phone/Collection/DefenseStatusIcon.png new file mode 100644 index 0000000..6fa5bd1 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/Collection/DefenseStatusIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/Collection/DisarmStatusIcon.png b/HDL-ON_iOS/Resources/Phone/Collection/DisarmStatusIcon.png new file mode 100644 index 0000000..da8a843 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/Collection/DisarmStatusIcon.png Binary files differ diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index b5eb5bb..8ea5c0b 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -278,6 +278,10 @@ } } + + //======================瀹夐槻==================== + GetSecurityList(); + } catch (Exception ex) { @@ -376,14 +380,14 @@ var pack = Ins.HttpRequest.GetSecurityList(); if (pack.Code == StateCode.SUCCESS) { - var packList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SecurityAlarm>>(pack.Data.ToString()); + var packList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(pack.Data.ToString()); var sidList = new List<string>(); foreach (var function in packList) { sidList.Add(function.sid); } var infoListPack = Ins.httpRequest.GetSecurityInfo(sidList, new List<string>()); - var infoList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SecurityAlarm>>(infoListPack.Data.ToString()); + var infoList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(infoListPack.Data.ToString()); foreach (var function in infoList) { function.SaveFile(); diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 8b79424..a8f6fcb 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -4,6 +4,29 @@ { public static class StringId { + /// <summary> + /// 娣诲姞鍛婅鐩爣 + /// </summary> + public const int AddAlarmTarget = 500; + /// <summary> + /// 娣诲姞甯冮槻鍔熻兘 + /// </summary> + public const int AddDefenseFunction = 499; + /// <summary> + /// 瑙﹀彂寤舵椂 + /// </summary> + public const int TriggerDelay = 498; + /// <summary> + /// 鑷畾涔� + /// </summary> + public const int Custom = 497; + /// <summary> + /// 杩樻病鏈夊叧鑱斾换鍔″竷闃茬姸鎬� + /// </summary> + public const int ThereIsNoAssociatedTaskDeploymentStatus = 496; + /// <summary> + /// 浜鸿劯閫氳璁剧疆 + /// </summary> public const int FacePassageSetting = 495; /// <summary> /// 璁剧疆闈㈠ diff --git a/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs b/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs index db8e6c3..dffe522 100644 --- a/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs +++ b/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs @@ -241,7 +241,7 @@ { //鍏ㄩ儴 btnFloorName.Text = Language.StringByID(StringId.All); - btnFloorName.Width = btnFloorName.GetTextWidth(); + //btnFloorName.Width = btnFloorName.GetTextWidth(); } //鎴块棿 else if (selectType == 3) diff --git a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs index 91acb3a..3292d0a 100644 --- a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs +++ b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs @@ -130,5 +130,16 @@ return $"/user/{Control.Ins.GatewayId}/custom/scene/execute"; } } + + /// <summary> + /// 瀹夐槻鎺у埗 + /// </summary> + public string ControlSeurity + { + get + { + return $"/user/{Control.Ins.GatewayId}/custom/security/status/set"; + } + } } } \ No newline at end of file diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 99c5b0e..b72b210 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -622,6 +622,39 @@ } /// <summary> + /// 瀹夐槻鎺у埗 + /// </summary> + public void ControlSecurity(SecurityAlarm securityAlarm,string state) + { + if (!Ins.GatewayOnline_Local)//缃戝叧鏈湴涓嶅湪绾� + { + var pm = new DAL.Server.HttpServerRequest(); + var result = pm.SetSecurityStatus(new List<SecurityState>() { new SecurityState() { + gatewayId = DB_ResidenceData.Instance.HomeGateway.gatewayId, + sid = securityAlarm.sid, status = state, userSecurityId = securityAlarm.userSecurityId + } }); + } + else + { + Dictionary<string, string> keys = new Dictionary<string, string>(); + keys.Add("sid", securityAlarm.sid); + keys.Add("status", state); + var aLinkData = new AlinkReadFunctionStatusObj() + { + id = Ins.msg_id.ToString(), + objects = new List<Dictionary<string, string>>() + { + keys + }, + time_stamp = Utlis.GetTimestamp() + }; + var aLinkJson = Newtonsoft.Json.JsonConvert.SerializeObject(aLinkData); + var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlSeurity, aLinkJson); + new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id); + } + } + + /// <summary> /// a鍗忚鎺у埗鍦烘櫙 /// </summary> /// <param name="scene"></param> @@ -746,6 +779,14 @@ //TODO 鏆傛椂涓嶄紶姝g‘鐨勬暟鎹笂鍘伙紝濡傛灉鍚庨潰瑕佷紭鍖栧墠闈㈣繖浜涗唬鐮� UpdataFunctionStatus(receiveObj.BodyDataString, null); } + else if (receiveObj.Topic == CommunicationTopic.ct.ControlSeurity +"_reply") + { + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(receiveObj.BodyDataString); + if (temp != null) + { + Control_Udp.ReceiveRepeatManager(temp.id, null); + } + } else { //涓�浜涚壒娈婄殑涓婚澶勭悊(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�) diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index b271fdb..0dec30c 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -18,8 +18,8 @@ /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs index 896cb34..0f6ca28 100644 --- a/HDL_ON/Entity/DB_ResidenceData.cs +++ b/HDL_ON/Entity/DB_ResidenceData.cs @@ -19,7 +19,6 @@ /// </summary> public string MasterToken; - //RegionInfoRes _residecenInfo; RegionInfoRes _residecenInfo = new RegionInfoRes(); /// <summary> /// 浣忓畢鍩虹淇℃伅 @@ -163,8 +162,8 @@ public HomeGatewayInfo HomeGateway; /// <summary> - /// 0:bus缃戝叧 - /// 1:A鍗忚缃戝叧 + /// 0:涓�绔彛 + /// 1:Link鍗忚缃戝叧 /// </summary> public int GatewayType { @@ -175,7 +174,7 @@ //#endif if (HomeGateway == null) return -1; - if (HomeGateway.gatewayType == "AGATEWAY") + if (HomeGateway.gatewayType != "BUSUDPGATEWAY") { return 1; } diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index 9399392..fa6176f 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -86,6 +86,10 @@ /// 鏀惰棌鏍囪 /// </summary> public bool collect = false; + /// <summary> + /// 鏄惁鍏佽鍒犻櫎 + /// </summary> + public bool can_delete = true; /// <summary> /// 鍒涘缓璇ュ満鏅殑鐢ㄦ埛ID @@ -545,10 +549,15 @@ /// <summary> /// 灞炴�у�煎崟浣� /// </summary> - public string GetUintString() + public string GetUintString(string inputKey = "") { var us = ""; - switch (key) + var swithchString = key; + if(!string.IsNullOrEmpty(inputKey)) + { + swithchString = inputKey; + } + switch (swithchString) { case FunctionAttributeKey.SetTemp: case FunctionAttributeKey.RoomTemp: diff --git a/HDL_ON/Entity/Function/SecurityAlarm.cs b/HDL_ON/Entity/Function/SecurityAlarm.cs index e342c89..4eda460 100644 --- a/HDL_ON/Entity/Function/SecurityAlarm.cs +++ b/HDL_ON/Entity/Function/SecurityAlarm.cs @@ -1,12 +1,117 @@ 锘縰sing System; using System.Collections.Generic; using HDL_ON.Common; +using HDL_ON.DAL.Server; using Shared; namespace HDL_ON.Entity { + /// <summary> + /// 瀹夐槻涓績 + /// </summary> + public class SecurityCenter + { + static SecurityCenter _center; + + public static SecurityCenter Security + { + get + { + if(_center == null) + { + _center = new SecurityCenter(); + } + return _center; + } + } + + SecurityAlarm _securityAlarm; + /// <summary> + /// 褰撳墠甯冮槻妯″紡 + /// </summary> + public SecurityAlarm CurrentDefenseMode + { + get + { + return _securityAlarm; + } + set + { + _securityAlarm = value; + UI.HomePage.LoadEvent_RefreshSecurityStatus(); + } + } + + HttpServerRequest httpServerRequest = new HttpServerRequest(); + + + + List<SecurityAlarm> _securityAlarmList; + /// <summary> + /// 闃插尯鍒楄〃 + /// </summary> + public List<SecurityAlarm> securityAlarmList + { + get + { + if(_securityAlarmList == null) + { + _securityAlarmList = GetSecurityAlarmList(); + } + return _securityAlarmList; + } + } + + + /// <summary> + /// 璇诲彇浜戠瀹夐槻鍒楄〃 + /// </summary> + /// <returns></returns> + public List<SecurityAlarm> GetSecurityAlarmList() + { + var pack = httpServerRequest.GetSecurityList(); + if(pack.Code == StateCode.SUCCESS) + { + var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SecurityAlarm>>(pack.Data.ToString()); + if(revData!= null) + { + _securityAlarmList = revData; + return revData; + } + } + return new List<SecurityAlarm>(); + } + + /// <summary> + /// 鐘舵�� enable甯冮槻銆乨isable鎾掗槻 + /// </summary> + public string status + { + get + { + string result = "disable"; + foreach(var s in securityAlarmList) + { + if(s.status == "enable") + { + result = "enable"; + break; + } + } + return result; + } + } + + + } + + public class SecurityAlarm { + /// <summary> + /// 瀹夐槻浜戠id + /// </summary> + public string userSecurityId; /// <summary> /// 瀹夐槻sid /// </summary> @@ -22,7 +127,7 @@ /// <summary> /// 鐘舵�� enable甯冮槻銆乨isable鎾掗槻 /// </summary> - public string status; + public string status = "disable"; /// <summary> /// 绫诲瀷 /// "all"--鍏ㄥ畢甯冮槻锛� @@ -30,7 +135,7 @@ /// "all_day":24灏忔椂, /// "mute"锛氶潤闊� /// </summary> - public string type; + public string type = "normal"; /// <summary> /// 鏇存柊鏃堕棿 /// </summary> @@ -71,6 +176,93 @@ var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtlis.Files.WriteFileByBytes(savePath, ssd); } + + /// <summary> + /// 淇濆瓨瀹夐槻淇℃伅 + /// </summary> + public string SaveInfo() + { + HttpServerRequest hsr = new HttpServerRequest(); + if (string.IsNullOrEmpty(sid)) + { + NewSid(); + var pack = hsr.AddSecurity(new List<SecurityAlarm>() { this }); + if (pack.Code == StateCode.SUCCESS) + { + SaveFile(); + }else + { + sid = ""; + } + return pack.Code; + } + else + { + var pack = hsr.EditSecurity(new List<SecurityAlarm>() { this }); + if (pack.Code == StateCode.SUCCESS) + { + SaveFile(); + } + return pack.Code; + } + } + + + /// <summary> + /// 鐢熸垚sid鏂规硶 + /// </summary> + public void NewSid() + { + try + { + string sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡 + DateTime dt = DateTime.Now; + DateTime startTime = TimeZoneInfo.ConvertTimeToUtc(new DateTime(2020, 1, 1)); + long m = (long)((dt - startTime).TotalMilliseconds / 10); + string sTimeSpan = "00000000"; + + byte[] arry = new byte[4]; + arry[0] = (byte)(m & 0xFF); + arry[1] = (byte)((m & 0xFF00) >> 8); + arry[2] = (byte)((m & 0xFF0000) >> 16); + arry[3] = (byte)((m >> 24) & 0xFF); + sTimeSpan = arry[0].ToString("X2") + arry[1].ToString("X2") + arry[2].ToString("X2") + arry[3].ToString("X2"); + + + if (sTimeSpan.Length >= 8) + { + sTimeSpan = sTimeSpan.Substring(0, 8); + } + else + { + sTimeSpan = Guid.NewGuid().ToString().Substring(0, 8); + //sTimeSpan = "00000000"; + } + + sid = sOidBeginsWith + sTimeSpan; + + sid += "16"; + sid += "1601"; + int maxId = 1; + + + for (int i = 0; i < SecurityCenter.Security.securityAlarmList.Count; i++) + { + string s = SecurityCenter.Security.securityAlarmList[i].sid.Substring(20, 4); + int iThisSceneId = Convert.ToInt16(s, 16); + if (iThisSceneId > maxId) + maxId = iThisSceneId; + } + + sid += (maxId + 1).ToString("X4"); + sid += "0000"; + } + catch + { + } + } + + } /// <summary> @@ -127,7 +319,6 @@ public string bypass; } - /// <summary> /// 瀹夐槻杈撳叆 /// </summary> @@ -147,6 +338,13 @@ /// </summary> public List<SecurityInputCondition> condition = new List<SecurityInputCondition>(); + /// <summary> + /// 鍔犲叆杈撳叆鏉′欢 + /// 鏈湴鍒ゆ柇浣跨敤 + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public bool addCondition = false; + [Newtonsoft.Json.JsonIgnore] Function _function = null; /// <summary> @@ -160,6 +358,65 @@ _function = FunctionList.List.Functions.Find((obj) => obj.sid == sid); } return _function; + } + + /// <summary> + /// 鑾峰彇鍗曚釜鐘舵�佺殑鏄剧ず鏂囨湰 + /// </summary> + /// <param name="inputValue"></param> + /// <returns></returns> + public string GetStateText(string inputValue) + { + string text = ""; + + if (GetFunction() == null) + return text; + switch (GetFunction().spk) + { + case SPK.SensorGas: + case SPK.SensorSmoke: + if (inputValue == "true") + { + text += Language.StringByID(StringId.InAlarm) + " "; + } + else if (inputValue == "false") + { + text += Language.StringByID(StringId.Normal) + " "; + } + break; + case SPK.SensorPir: + if (inputValue == "true") + { + text += Language.StringByID(StringId.youren) + " "; + } + else if (inputValue == "false") + { + text += Language.StringByID(StringId.wuren) + " "; + } + break; + case SPK.SensorWater: + if (inputValue == "true") + { + text += Language.StringByID(StringId.WaterLeakage) + " "; + } + else if (inputValue == "false") + { + text += Language.StringByID(StringId.Normal) + " "; + } + break; + case SPK.SensorDoorWindow: + if (inputValue == "true") + { + text += Language.StringByID(StringId.Open) + " "; + } + else if (inputValue == "false") + { + text += Language.StringByID(StringId.Close) + " "; + } + break; + } + + return text; } /// <summary> @@ -276,6 +533,13 @@ /// </summary> public List<SecurityOutputStatus> status = new List<SecurityOutputStatus>(); + /// <summary> + /// 鍔犲叆杈撳叆鏉′欢 + /// 鏈湴鍒ゆ柇浣跨敤 + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public bool addCondition = false; + [Newtonsoft.Json.JsonIgnore] Function _function = null; /// <summary> diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 0d84b83..4a04b6f 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -172,7 +172,14 @@ /// <summary> /// 瀹夐槻鍒楄〃 /// </summary> - public List<SecurityAlarm> securities = new List<SecurityAlarm>(); + public List<SecurityAlarm> securities + { + get + { + return SecurityCenter.Security.securityAlarmList; + } + } + /// <summary> /// 鍔犺浇鍔熻兘鍒楄〃 diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 403a3a5..163b1fa 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -472,6 +472,10 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddDevice\SenesorEnvironment\AddQingpingSensorEnvirTipPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Light\LightScene\AddLightScene.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\FaceManagement\FacePassagePage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\AddAlarmDeploymentPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\AddInputPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\AddOutputPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\AddOutputSettingPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index 291c974..1a51f05 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -25,7 +25,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string VersionString = "1.2.0817"; + public static string VersionString = "1.2.0820"; ///// <summary> ///// 瀹㈡埛绔被鍨� ///// </summary> diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index 5a4f32e..dc250ad 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -27,6 +27,12 @@ /// </summary> Button btnLinkStateTip; /// <summary> + /// 瀹夐槻鐘舵�佸浘鏍� + /// </summary> + Button btnSecurityStatus; + + + /// <summary> ///浣忓畢鍚嶇О鏄剧ず /// </summary> Button btnResidenceName; @@ -369,6 +375,28 @@ environmentalView.AddChidren(btnPm25Values); #endregion + btnSecurityStatus = new Button() + { + X = Application.GetRealWidth(329), + Y = Application.GetRealHeight(34), + Width = Application.GetRealWidth(30), + Height = Application.GetRealWidth(30), + SelectedImagePath = "Collection/DefenseStatusIcon.png", + UnSelectedImagePath = "Collection/DisarmStatusIcon.png" + }; + if (DB_ResidenceData.Instance.GatewayType == 1) + { + topView.AddChidren(btnSecurityStatus); + btnSecurityStatus.IsSelected = SecurityCenter.Security.CurrentDefenseMode != null; + btnSecurityStatus.MouseUpEventHandler = (sender, e) => { + var page = new ArmCenterPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + + #region msg FrameLayout msgView; msgView = new FrameLayout() @@ -512,16 +540,16 @@ // }, //}); - //FunctionList.List.Functions.Add(new Function() { - // spk = SPK.SensorGas, - // name = "鐕冩皵浼犳劅鍣�", - // attributes = new List<FunctionAttributes> () - // { - // new FunctionAttributes(){ key = "enable",curValue= "true",state = "true" ,value = new List<string>(){ "true", "false" } }, - // new FunctionAttributes(){ key = "status",curValue= "normal",state = "normal" ,value = new List<string>(){ "alarm", "normal" } }, - - // }, - //}); + FunctionList.List.Functions.Add(new Function() + { + spk = SPK.SensorGas, + name = "鐕冩皵浼犳劅鍣�", + attributes = new List<FunctionAttributes>() + { + new FunctionAttributes(){ key = "enable",curValue= "true",state = "true" ,value = new List<string>(){ "true", "false" } }, + new FunctionAttributes(){ key = "status",curValue= "normal",state = "normal" ,value = new List<string>(){ "alarm", "normal" } }, + }, + }); //FunctionList.List.Functions.Add(new Function() { spk = SPK.PjtIr, name = "娴嬭瘯鎶曞奖浠�", // attributes = new List<FunctionAttributes>() { diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index 8cb90b4..7cd1ce4 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -14,12 +14,29 @@ /// </summary> public static void LoadEvent_RefreshAir() { - if (bodyView != null) + Application.RunOnMainThread(() => { - bodyView.btnTempValues.Text = MainPage.cityInfo.temperature == null ? "--" : MainPage.cityInfo.temperature + "掳"; - bodyView.btnHumidityValues.Text = MainPage.cityInfo.humidity == null ? "--" : MainPage.cityInfo.humidity + "%"; - bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25; - } + if (bodyView != null) + { + bodyView.btnTempValues.Text = MainPage.cityInfo.temperature == null ? "--" : MainPage.cityInfo.temperature + "掳"; + bodyView.btnHumidityValues.Text = MainPage.cityInfo.humidity == null ? "--" : MainPage.cityInfo.humidity + "%"; + bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25; + } + }); + } + + /// <summary> + /// 鏇存柊瀹夐槻鐘舵�� + /// </summary> + public static void LoadEvent_RefreshSecurityStatus() + { + Application.RunOnMainThread(() => + { + if (bodyView != null) + { + bodyView.btnSecurityStatus.IsSelected = SecurityCenter.Security.CurrentDefenseMode != null; + } + }); } /// <summary> diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 3accadc..890573b 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -725,9 +725,10 @@ break; case ShowFunction.SecurityCenter: functionCount = FunctionList.List.securities.Count; -#if DEBUG - functionCount = 1; -#endif + if (DB_ResidenceData.Instance.GatewayType == 1) + { + functionCount = 1; + } break; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs index cfab368..67f47d5 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs @@ -373,8 +373,10 @@ BackgroundColor = CSS_Color.MainBackgroundColor, //IsBold = true }; - bodyView.AddChidren(btnComplete); - + if (scene.can_delete) + { + bodyView.AddChidren(btnComplete); + } LoadEventList(); var waitPage = new Loading(); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs index 9401786..05c2a9c 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs @@ -157,7 +157,6 @@ /// <summary> /// 鏄剧ず鍔熻兘Row /// </summary> - /// <param name="showUnallocated">鏄惁鏄樉绀烘湭鍒嗛厤</param> void LoadFunctionListRow(List<Function> functions) { functionListView.RemoveAll(); diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs new file mode 100644 index 0000000..d47f84d --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs @@ -0,0 +1,627 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.DAL.Server; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; +namespace HDL_ON.UI +{ + public class AddAlarmDeploymentPage : FrameLayout + { + FrameLayout bodyView; + /// <summary> + /// 涓婚鐣岄潰 + /// </summary> + VerticalScrolViewLayout contentView; + /// <summary> + /// 杈撳叆鏉′欢鍒楄〃鍖哄煙鐣岄潰 + /// </summary> + VerticalScrolViewLayout inputTargetView; + /// <summary> + /// 鍛婅鐩爣鍒楄〃鍖哄煙鐣岄潰 + /// </summary> + VerticalScrolViewLayout outputTargetView; + + + SecurityAlarm securityAlarm; + Action refreshAction; + + public AddAlarmDeploymentPage(SecurityAlarm alarm, Action action) + { + bodyView = this; + securityAlarm = alarm; + refreshAction = action; + } + + public void LoadPage() + { + new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView(); + + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + + contentView = new VerticalScrolViewLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(527), + }; + bodyView.AddChidren(contentView); + + #region 甯冮槻淇℃伅 + var deploymentTitleRow = new FrameLayout() + { + Height = Application.GetRealHeight(44), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(deploymentTitleRow); + + var btnDeploymentTitle = new Button() + { + X = Application.GetRealWidth(16), + TextColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.DeploymentInformation, + IsBold = true, + }; + deploymentTitleRow.AddChidren(btnDeploymentTitle); + + deploymentTitleRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + + #region 甯冮槻鍚嶇О + var deploymentNameRow = new FrameLayout() + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(deploymentNameRow); + + var btnDeploymentNameTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(72), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Name, + }; + deploymentNameRow.AddChidren(btnDeploymentNameTitle); + btnDeploymentNameTitle.Text += ":"; + + var btnDeploymentName = new Button() + { + X = Application.GetRealWidth(88), + Width = Application.GetRealWidth(230), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + Text = securityAlarm.name + }; + deploymentNameRow.AddChidren(btnDeploymentName); + deploymentNameRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + + LoadEvent_EditSecurityAlarmName(btnDeploymentName); + #endregion + + /* + #region 瑙﹀彂寤舵椂 + var delayedRow = new FrameLayout() + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(delayedRow); + + var btnDelayedTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(72), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.TriggerDelay, + }; + delayedRow.AddChidren(btnDelayedTitle); + btnDelayedTitle.Text += ":"; + + var btnDelayedText = new Button() + { + X = Application.GetRealWidth(88), + Width = Application.GetRealWidth(230), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + Text = securityAlarm.name + }; + delayedRow.AddChidren(btnDelayedText); + + var btnDelayedRight = new Button() + { + X = Application.GetRealWidth(343), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/RightIcon.png", + }; + delayedRow.AddChidren(btnDelayedRight); + + //delayedRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + #endregion + */ + + #endregion + contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); + + //甯冮槻鍔熻兘 + iniDefenseView(); + //鍛婅鐩爣 + iniAlarmView(); + + #region 搴曢儴鍖哄煙 + var bottomView = new FrameLayout() + { + Y = Application.GetRealHeight(591), + Height = Application.GetRealHeight(100), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(22), + }; + this.AddChidren(bottomView); + + var btnConfrim = new Button() + { + X = Application.GetRealWidth(78), + Y = Application.GetRealHeight(12), + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + Radius = (uint)Application.GetRealWidth(22), + BackgroundColor = CSS_Color.MainColor, + TextID = StringId.Confirm, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + TextAlignment = TextAlignment.Center, + }; + bottomView.AddChidren(btnConfrim); + + btnConfrim.MouseUpEventHandler = (sender, e) => + { + if (securityAlarm.input.Count == 0) + { + var tip = new Tip() + { + Text = "璇烽�夋嫨甯冮槻鐩爣", + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(MainPage.BaseView); + return; + } + if (securityAlarm.output.Count == 0) + { + var tip = new Tip() + { + Text = "璇烽�夋嫨鍛婅鐩爣", + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(MainPage.BaseView); + + return; + } + + var waitPage = new Loading(); + waitPage.Start(); + new System.Threading.Thread(() => + { + try + { + var code = securityAlarm.SaveInfo(); + if (code == StateCode.SUCCESS) + { + SecurityCenter.Security.GetSecurityAlarmList(); + Application.RunOnMainThread(() => + { + this.RemoveFromParent(); + refreshAction?.Invoke(); + }); + } + else + { + Application.RunOnMainThread(() => + { + IMessageCommon.Current.ShowErrorInfoAlter(code); + }); + } + } + catch { } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + }; + #endregion + + } + + /// <summary> + /// 鍒濆鍖栭儴鍒嗗姛鑳藉尯鍩� + /// </summary> + private void iniDefenseView() + { + + #region 甯冮槻鍔熻兘 + var deploymentFunctionRow = new FrameLayout() + { + Height = Application.GetRealHeight(44), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(deploymentFunctionRow); + + var btnFunctionTitle = new Button() + { + X = Application.GetRealWidth(16), + TextColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.DefenseFunctionArmState, + IsBold = true, + }; + deploymentFunctionRow.AddChidren(btnFunctionTitle); + + var btnAddTarget = new Button() + { + X = Application.GetRealWidth(337), + Y = Application.GetRealHeight(6), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "FunctionIcon/ArmCenter/AddTargetIcon.png", + }; + deploymentFunctionRow.AddChidren(btnAddTarget); + ///娣诲姞杈撳叆鐩爣 + btnAddTarget.MouseUpEventHandler = (sender, e) => { + Action<SecurityAlarm> action = (outTemp) => { + securityAlarm = outTemp; + iniInputTargetView(); + }; + var page = new AddInputPage(securityAlarm, action); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + deploymentFunctionRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + + inputTargetView = new VerticalScrolViewLayout() + { + ScrollEnabled = false, + }; + contentView.AddChidren(inputTargetView); + + iniInputTargetView(); + + #endregion + contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); + + } + + /// <summary> + /// 鍒濆鍖栬緭鍏ユ潯浠跺尯鍩熺晫闈� + /// </summary> + /// <param name=""></param> + private void iniInputTargetView() + { + inputTargetView.RemoveAll(); + if (securityAlarm.input.Count > 0) + { + foreach (var target in securityAlarm.input) + { + inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName(),target.StateText())); + } + inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count); + //if (outputTargetView != null) + //{ + // contentView.AddChidren(outputTargetView); + //} + } + else + { + inputTargetView.AddChidren(new Button() + { + Height = Application.GetRealHeight(65), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + TextID = StringId.ThereIsNoAssociatedTaskDeploymentStatus, + IsMoreLines = true, + BackgroundColor = CSS_Color.MainBackgroundColor, + }); + + inputTargetView.Height = Application.GetRealHeight(68); + //if(outputTargetView!= null) + //{ + // contentView.AddChidren(outputTargetView); + //} + } + + + } + + /// <summary> + /// 鍒濆鍖栧憡璀︾洰鏍囧尯鍩� + /// </summary> + private void iniAlarmView() + { + #region 鍛婅鐩爣 + var outputRow = new FrameLayout() + { + Height = Application.GetRealHeight(44), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(outputRow); + + var btnOutputRowTitle = new Button() + { + X = Application.GetRealWidth(16), + TextColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.AlarmTargetAfterTriggering, + IsBold = true, + }; + outputRow.AddChidren(btnOutputRowTitle); + + var btnAddOutTarget = new Button() + { + X = Application.GetRealWidth(337), + Y = Application.GetRealHeight(6), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "FunctionIcon/ArmCenter/AddTargetIcon.png", + }; + outputRow.AddChidren(btnAddOutTarget); + + btnAddOutTarget.MouseUpEventHandler = (sender, e) => { + Action<SecurityAlarm> action = (outTemp) => { + securityAlarm = outTemp; + iniAlarmListView(); + }; + var page = new AddOutputPage(securityAlarm, action); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + outputRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + + + outputTargetView = new VerticalScrolViewLayout() + { + ScrollEnabled = false, + }; + contentView.AddChidren(outputTargetView); + + iniAlarmListView(); + + #endregion + contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); + + } + + /// <summary> + /// 鍒濆鍖栧憡璀﹀垪琛ㄥ尯鍩� + /// </summary> + private void iniAlarmListView() + { + outputTargetView.RemoveAll(); + if (securityAlarm.output.Count > 0) + { + foreach (var outTarget in securityAlarm.output) + { + outputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(), "鎵撳紑")); + } + outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); + } + else + { + outputTargetView.AddChidren(new Button() + { + Height = Application.GetRealHeight(65), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + TextID = StringId.ThereIsNoAssociatedTaskDeploymentStatus, + IsMoreLines = true, + BackgroundColor = CSS_Color.MainBackgroundColor, + }); + } + } + + + /// <summary> + /// 淇敼瀹夐槻鍚嶇О + /// </summary> + void LoadEvent_EditSecurityAlarmName(Button btnDeploymentName) + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + Action<string> callBack = (str) => + { + //鍚嶇О涓嶈兘涓虹┖ + if (string.IsNullOrEmpty(str)) + { + new Tip() + { + CloseTime = 1, + Text = Language.StringByID(StringId.NameCannotBeEmpty), + Direction = AMPopTipDirection.None, + }.Show(bodyView); + return; + } + + + btnDeploymentName.Text = securityAlarm.name = str; + + }; + new PublicAssmebly().LoadDialog_EditParater(StringId.Name, securityAlarm.name, callBack, StringId.NameCannotBeEmpty, 0, new List<string>()); + }; + btnDeploymentName.MouseUpEventHandler = eventHandler; + } + + /// <summary> + /// 娣诲姞瀹夐槻 + /// </summary> + void LoadEvent_AddDefense() + { + var responsePack = new HttpServerRequest().AddSecurity(new List<SecurityAlarm>() { securityAlarm}); + if (responsePack.Code == StateCode.SUCCESS) + { + Application.RunOnMainThread(() => + { + this.RemoveFromParent(); + }); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(responsePack.Code); + } + } + + } + + /// <summary> + /// 杈撳叆鏉′欢琛屾帶浠� + /// </summary> + public class InputRow : RowLayout + { + Button btnTitle; + + Button btnSubTitle; + + public InputRow(string title, string subtitle,string state) + { + this.LineColor = 0x00000000; + this.Height = Application.GetRealHeight(65); + this.BackgroundColor = CSS_Color.MainBackgroundColor; + + btnTitle = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(320), + Text = title, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + }; + this.AddChidren(btnTitle); + + btnSubTitle = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(24), + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(320), + Text = subtitle, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + this.AddChidren(btnSubTitle); + + + Button btnState = new Button() + { + Width = Application.GetRealWidth(369), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = state + }; + this.AddChidren(btnState); + + + } + + public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) + { + this.MouseUpEventHandler = eventHandler; + btnTitle.MouseUpEventHandler = eventHandler; + btnSubTitle.MouseUpEventHandler = eventHandler; + } + } + + /// <summary> + /// 杈撳嚭鏉′欢鎺т欢 + /// </summary> + public class OutputRow : RowLayout + { + Button btnTitle; + + Button btnSubTitle; + + Button btnState; + + Button btnRightIcon; + + public OutputRow(string title, string subtitle, string state) + { + this.LineColor = 0x00000000; + this.Height = Application.GetRealHeight(65); + this.BackgroundColor = CSS_Color.MainBackgroundColor; + + btnTitle = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(320), + Text = title, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + }; + this.AddChidren(btnTitle); + + btnSubTitle = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(24), + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(320), + Text = subtitle, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + this.AddChidren(btnSubTitle); + + btnState = new Button() + { + Width = Application.GetRealWidth(323), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + Text = state + }; + this.AddChidren(btnState); + + btnRightIcon = new Button() + { + X = Application.GetRealWidth(339), + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "FunctionIcon/ArmCenter/RightIcon.png", + }; + this.AddChidren(btnRightIcon); + } + + public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) + { + btnState.MouseUpEventHandler = eventHandler; + btnTitle.MouseUpEventHandler = eventHandler; + btnSubTitle.MouseUpEventHandler = eventHandler; + } + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs new file mode 100644 index 0000000..9d0a8c2 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs @@ -0,0 +1,388 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.DAL.Server; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON.UI +{ + public class AddInputPage : FrameLayout + { + FrameLayout bodyView; + VerticalScrolViewLayout functionListView; + + Action<SecurityAlarm> refreshAction; + + SecurityAlarm securityAlarm; + List<SecurityInput> inputList = new List<SecurityInput>(); + + public AddInputPage(SecurityAlarm alarm,Action<SecurityAlarm> action) + { + bodyView = this; + securityAlarm = alarm; + refreshAction = action; + } + + + /// <summary> + /// 鍔犺浇鐣岄潰 + /// </summary> + public void LoadPage() + { + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + new TopViewDiv(bodyView, Language.StringByID(StringId.AddDefenseFunction)).LoadTopView(); + + #region 鏄剧ず鐨勫姛鑳界被鍨嬪垏鎹㈠尯鍩� + var showdFunctionTypeRow = new FrameLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(53), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(showdFunctionTypeRow); + + + var btnFloorDownIcon = new Button() + { + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(18), + UnSelectedImagePath = "Public/DownIcon.png", + }; + showdFunctionTypeRow.AddChidren(btnFloorDownIcon); + + var btnFloor = new Button() + { + X = btnFloorDownIcon.Right, + Y = Application.GetRealHeight(18), + Width = Application.GetRealWidth(200), + Height = Application.GetMinRealAverage(16), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextAlignment = TextAlignment.CenterLeft, + Text = DB_ResidenceData.Instance.CurFloor.roomName, + }; + showdFunctionTypeRow.AddChidren(btnFloor); + btnFloor.MouseUpEventHandler += (sender, e) => + { + string nowSelectId = null; + var listAllFun = FunctionList.List.GetArmSensorList(); + + //鏄剧ず涓嬫媺鐣岄潰 + var form = new FloorRoomSelectPopupView(); + form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) => + { + nowSelectId = selectId; + //閲嶆柊鍒锋柊璁惧鍒楄〃 + this.LoadFunctionListRow(listFun); + }, nowSelectId); + }; + + + #endregion + + functionListView = new VerticalScrolViewLayout() + { + Y = showdFunctionTypeRow.Bottom, + Height = Application.GetRealHeight(530), + BackgroundColor = CSS_Color.BackgroundColor, + }; + bodyView.AddChidren(functionListView); + + + + LoadFunctionListRow(FunctionList.List.GetArmSensorList()); + + + + var bottomView = new FrameLayout() + { + Y = Application.GetRealHeight(591), + Height = Application.GetRealHeight(100), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(22), + }; + this.AddChidren(bottomView); + + var btnConfrim = new Button() + { + X = Application.GetRealWidth(78), + Y = Application.GetRealHeight(12), + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + Radius = (uint)Application.GetRealWidth(22), + BackgroundColor = CSS_Color.MainColor, + TextID = StringId.Confirm, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + TextAlignment = TextAlignment.Center, + }; + bottomView.AddChidren(btnConfrim); + btnConfrim.MouseUpEventHandler = (sender, e) => + { + securityAlarm.input = new List<SecurityInput>(); + foreach (var input in inputList) + { + if (input.addCondition) + { + securityAlarm.input.Add(input); + } + } + this.RemoveFromParent(); + refreshAction?.Invoke(securityAlarm); + }; + + + + } + + + // <summary> + /// 鏄剧ず鍔熻兘Row + /// </summary> + void LoadFunctionListRow(List<Function> functions) + { + functionListView.RemoveAll(); + if (functions == null) + { + //鍒濆鍊� + functions = FunctionList.List.GetArmSensorList(); + } + foreach (var function in functions) + { + var input = securityAlarm.input.Find((obj) => obj.sid == function.sid); + if (input == null) + { + input = new SecurityInput(); + input.sid = function.sid; + } + else + { + input.addCondition = true; + } + inputList.Add(input); + + FrameLayout functionRow = new FrameLayout() + { + Height = Application.GetRealHeight(65), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + functionListView.AddChidren(functionRow); + + var btnFunctionName = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(44), + Text = function.name, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + }; + functionRow.AddChidren(btnFunctionName); + + var btnFunctionFloorName = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(24), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(41), + Text = function.GetRoomListName(), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, + }; + functionRow.AddChidren(btnFunctionFloorName); + + Button btnState = new Button() + { + Width = Application.GetRealWidth(317), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + }; + functionRow.AddChidren(btnState); + + + Button btnChooseIcon = new Button() + { + X = Application.GetRealWidth(333), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(32), + Height = Application.GetMinRealAverage(32), + UnSelectedImagePath = "Public/ChooseIcon.png", + SelectedImagePath = "Public/ChooseOnIcon.png", + }; + functionRow.AddChidren(btnChooseIcon); + + btnChooseIcon.MouseUpEventHandler = (sender, e) => { + btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected; + if(btnChooseIcon.IsSelected) + { + input.addCondition = true; + if (input.condition.Count==0) + { + ShowStateDialog(input, btnState,btnChooseIcon); + } + } + else + { + input.addCondition = false; + } + }; + btnState.MouseUpEventHandler = (sender, e) => + { + ShowStateDialog(input, btnState, btnChooseIcon); + }; + + + if (input.addCondition) + { + btnChooseIcon.IsSelected = true; + btnState.Text = input.StateText(); + } + + + functionListView.AddChidren(new Button() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(1), + BackgroundColor = CSS_Color.DividingLineColor, + }); + + + } + } + + + private void ShowStateDialog(SecurityInput input,Button btnState,Button btnChoose = null) + { + Dialog dialog = new Dialog(); + + FrameLayout contentView = new FrameLayout(); + dialog.AddChidren(contentView); + contentView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + if (input.condition.Count == 0) + { + if (btnChoose != null) + { + btnChoose.IsSelected = false; + } + } + }; + + VerticalScrolViewLayout optinView = new VerticalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(515), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(88), + Radius = (uint)Application.GetRealHeight(13), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(optinView); + + Button btnOpen = new Button() + { + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + Text = input.GetStateText("true") + }; + optinView.AddChidren(btnOpen); + + optinView.AddChidren(new Button() + { + Height = 1, + BackgroundColor = CSS_Color.DividingLineColor + }); + + Button btnClose = new Button() + { + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.PromptingColor1, + Text = input.GetStateText("false"), + TextSize = CSS_FontSize.SubheadingFontSize, + }; + optinView.AddChidren(btnClose); + + + Button btnCancel = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = optinView.Bottom + Application.GetRealHeight(8), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(44), + Radius = (uint)Application.GetRealHeight(13), + BackgroundColor = CSS_Color.MainBackgroundColor, + TextID = StringId.Cancel, + TextColor = CSS_Color.WarningColor, + IsBold = true, + }; + contentView.AddChidren(btnCancel); + + dialog.Show(); + + btnOpen.MouseUpEventHandler = (sender, e) => { + btnState.Text = btnOpen.Text; + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = "status", + value = "true", + } + }; + input.addCondition = true; + if (btnChoose != null) + { + btnChoose.IsSelected = true; + } + dialog.Close(); + }; + + btnClose.MouseUpEventHandler = (sender, e) => + { + btnState.Text = btnClose.Text; + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = "status", + value = "false", + } + }; + input.addCondition = true; + if (btnChoose != null) + { + btnChoose.IsSelected = true; + } + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + if (input.condition.Count == 0) + { + if (btnChoose != null) + { + btnChoose.IsSelected = false; + } + } + + }; + + } + + + } + +} \ No newline at end of file diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs new file mode 100644 index 0000000..9aac9de --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs @@ -0,0 +1,441 @@ +锘縰sing System; +using Shared; +using System.Text.RegularExpressions; +using System.Collections.Generic; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; + +namespace HDL_ON.UI +{ + public class AddOutputPage : FrameLayout + { + FrameLayout bodyView; + + FrameLayout showdFunctionTypeRow; + + /// <summary> + /// 妤煎眰閫夋嫨涓嬫媺鍥炬爣 + /// </summary> + Button btnFloorDownIcon; + /// <summary> + /// 妤煎眰鏄剧ず + /// </summary> + Button btnFloor; + + /// <summary> + /// 绛涢�夋枃鏈樉绀� + /// </summary> + Button btnScreenText; + + VerticalScrolViewLayout functionListView; + + SecurityAlarm securityAlarm; + Action<SecurityAlarm> refreshAction; + List<SecurityOutput> outputList = new List<SecurityOutput>(); + + List<Function> allocatedList = new List<Function>(); + + public AddOutputPage(SecurityAlarm function, Action<SecurityAlarm> action) + { + bodyView = this; + securityAlarm = function; + refreshAction = action; + } + + + /// <summary> + /// 鍔犺浇鐣岄潰 + /// </summary> + public void LoadPage() + { + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)).LoadTopView(); + + #region 鏄剧ず鐨勫姛鑳界被鍨嬪垏鎹㈠尯鍩� + showdFunctionTypeRow = new FrameLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(62), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(showdFunctionTypeRow); + + + btnFloorDownIcon = new Button() + { + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(18), + UnSelectedImagePath = "Public/DownIcon.png", + }; + showdFunctionTypeRow.AddChidren(btnFloorDownIcon); + + btnFloor = new Button() + { + X = btnFloorDownIcon.Right, + Y = Application.GetRealHeight(18), + Width = Application.GetRealWidth(200), + Height = Application.GetMinRealAverage(16), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextAlignment = TextAlignment.CenterLeft, + Text = DB_ResidenceData.Instance.CurFloor.roomName, + }; + showdFunctionTypeRow.AddChidren(btnFloor); + + #endregion + + functionListView = new VerticalScrolViewLayout() + { + Y = showdFunctionTypeRow.Bottom, + Height = Application.GetRealHeight(530 -100), + BackgroundColor = CSS_Color.BackgroundColor, + }; + bodyView.AddChidren(functionListView); + + + + + + + foreach (var function in FunctionList.List.Functions) + { + if (!MainPage.SceneSupportFunctionList.Contains(function.spk)) + { + continue; + } + if (function == null) + { + continue; + } + function.roomIds.Remove(null); + allocatedList.Add(function); + } + + LoadFunctionListRow(null); + + + + + + + + var bottomView = new FrameLayout() + { + Y = Application.GetRealHeight(591), + Height = Application.GetRealHeight(100), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(22), + }; + this.AddChidren(bottomView); + + var btnConfrim = new Button() + { + X = Application.GetRealWidth(78), + Y = Application.GetRealHeight(12), + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + Radius = (uint)Application.GetRealWidth(22), + BackgroundColor = CSS_Color.MainColor, + TextID = StringId.Confirm, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + TextAlignment = TextAlignment.Center, + }; + bottomView.AddChidren(btnConfrim); + btnConfrim.MouseUpEventHandler = (sender, e) => + { + securityAlarm.output = new List<SecurityOutput>(); + foreach (var output in outputList) + { + if (output.addCondition) + { + securityAlarm.output.Add(output); + } + } + this.RemoveFromParent(); + refreshAction?.Invoke(securityAlarm); + }; + + + + + + + } + + + + + // <summary> + /// 鏄剧ず鍔熻兘Row + /// </summary> + void LoadFunctionListRow(List<Function> functions) + { + functionListView.RemoveAll(); + if (functions == null) + { + functions = allocatedList; + } + foreach (var function in functions) + { + var output = securityAlarm.output.Find((obj) => obj.sid == function.sid); + if (output == null) + { + output = new SecurityOutput(); + output.sid = function.sid; + } + else + { + output.addCondition = true; + } + outputList.Add(output); + + FrameLayout functionRow = new FrameLayout() + { + Height = Application.GetRealHeight(65), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + functionListView.AddChidren(functionRow); + + var btnFunctionName = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(44), + Text = function.name, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + }; + functionRow.AddChidren(btnFunctionName); + + var btnFunctionFloorName = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(24), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(41), + Text = function.GetRoomListName(), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, + }; + functionRow.AddChidren(btnFunctionFloorName); + + Button btnState = new Button() + { + Width = Application.GetRealWidth(317), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + }; + functionRow.AddChidren(btnState); + + + Button btnChooseIcon = new Button() + { + X = Application.GetRealWidth(333), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(32), + Height = Application.GetMinRealAverage(32), + UnSelectedImagePath = "Public/ChooseIcon.png", + SelectedImagePath = "Public/ChooseOnIcon.png", + }; + functionRow.AddChidren(btnChooseIcon); + + btnChooseIcon.MouseUpEventHandler = (sender, e) => { + btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected; + if (btnChooseIcon.IsSelected) + { + output.addCondition = true; + if (output.status.Count == 0) + { + ShowStateDialog(output, btnState,btnChooseIcon); + } + } + else + { + output.addCondition = false; + } + }; + btnState.MouseUpEventHandler = (sender, e) => + { + ShowStateDialog(output, btnState, btnChooseIcon); + }; + + + if (output.addCondition) + { + btnChooseIcon.IsSelected = true; + btnState.Text = output.StateText(); + } + + + functionListView.AddChidren(new Button() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(1), + BackgroundColor = CSS_Color.DividingLineColor, + }); + + + } + } + + + + private void ShowStateDialog(SecurityOutput output, Button btnState, Button btnChoose = null) + { + Dialog dialog = new Dialog(); + + FrameLayout contentView = new FrameLayout(); + dialog.AddChidren(contentView); + contentView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + if (output.status.Count == 0) + { + if (btnChoose != null) + { + btnChoose.IsSelected = false; + } + } + }; + + VerticalScrolViewLayout optinView = new VerticalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(515), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(88), + Radius = (uint)Application.GetRealHeight(13), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(optinView); + + Button btnOpen = new Button() + { + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.On + }; + optinView.AddChidren(btnOpen); + + optinView.AddChidren(new Button() + { + Height = 1, + BackgroundColor = CSS_Color.DividingLineColor + }); + + Button btnClose = new Button() + { + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.PromptingColor1, + TextID = StringId.OFF, + TextSize = CSS_FontSize.SubheadingFontSize, + }; + optinView.AddChidren(btnClose); + + + Button btnCancel = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = optinView.Bottom + Application.GetRealHeight(8), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(44), + Radius = (uint)Application.GetRealHeight(13), + BackgroundColor = CSS_Color.MainBackgroundColor, + TextID = StringId.Cancel, + TextColor = CSS_Color.WarningColor, + IsBold = true, + }; + contentView.AddChidren(btnCancel); + + dialog.Show(); + + btnOpen.MouseUpEventHandler = (sender, e) => { + btnState.Text = btnOpen.Text; + output.status = new List<SecurityOutputStatus>() + { + new SecurityOutputStatus() + { + key = FunctionAttributeKey.OnOff, + value = "on", + } + }; + output.addCondition = true; + if (btnChoose != null) + { + btnChoose.IsSelected = true; + } + dialog.Close(); + }; + + btnClose.MouseUpEventHandler = (sender, e) => + { + btnState.Text = btnClose.Text; + output.status = new List<SecurityOutputStatus>() + { + new SecurityOutputStatus() + { + key = FunctionAttributeKey.OnOff, + value = "off", + } + }; + output.addCondition = true; + if (btnChoose != null) + { + btnChoose.IsSelected = true; + } + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + if (output.status.Count == 0) + { + if (btnChoose != null) + { + btnChoose.IsSelected = false; + } + } + + }; + + } + + + + + /// <summary> + /// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢 + /// </summary> + void LoadDialog_ChangeFloor() + { + string nowSelectId = null; + btnFloor.MouseUpEventHandler += (sender, e) => + { + var listAllFun = new List<Function>(); + listAllFun.AddRange(allocatedList); + + //鏄剧ず涓嬫媺鐣岄潰 + var form = new FloorRoomSelectPopupView(); + form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) => + { + nowSelectId = selectId; + //閲嶆柊鍒锋柊璁惧鍒楄〃 + this.LoadFunctionListRow(listFun); + }, nowSelectId); + }; + } + + + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputSettingPage.cs new file mode 100644 index 0000000..5f6e9d6 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputSettingPage.cs @@ -0,0 +1,995 @@ +锘�//using System; +//using System.Collections.Generic; +//using HDL_ON.Entity; +//using HDL_ON.UI.CSS; +//using Shared; + +//namespace HDL_ON.UI +//{ +// public class AddOutputSettingPage : FrameLayout +// { +// FrameLayout bodyView; +// VerticalScrolViewLayout contentView; +// Button btnOnText; +// Button btnBrightnessText; + +// SecurityAlarm securityAlarm; +// Function alarmFunction; +// Action refreshAction; + + +// List<SecurityOutput> outputList = new List<SecurityOutput>(); + + +// public AddOutputSettingPage(SecurityAlarm alarm,Function function, Action action) +// { +// bodyView = this; +// securityAlarm = alarm; +// refreshAction = action; +// alarmFunction = function; +// } + +// public void LoadPage() +// { +// bodyView.BackgroundColor = CSS_Color.BackgroundColor; + +// new TopViewDiv(bodyView, Language.StringByID(StringId.AddAlarmTarget)).LoadTopView(); + +// contentView = new VerticalScrolViewLayout() +// { +// Y = Application.GetRealHeight(64), +// Height = Application.GetRealHeight(520), +// ScrollEnabled = false, +// }; +// bodyView.AddChidren(contentView); + +// var output = securityAlarm.output.Find((obj) => obj.sid == alarmFunction.sid); +// if (output == null) +// { +// output = new SecurityOutput(); +// output.sid = alarmFunction.sid; +// } +// else +// { +// output.addCondition = true; +// } +// inputList.Add(output); + +// LoadFunctionRow(alarmFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.OnOff)); + +// foreach (var attr in alarmFunction.attributes) +// { + + + +// switch (attr.key) +// { +// case FunctionAttributeKey.SetTemp: +// LoadFunctionRow(alarmFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.SetTemp)); +// break; +// case FunctionAttributeKey.Mode: + +// LoadFunctionRow(alarmFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.Mode)); +// break; +// case FunctionAttributeKey.FanSpeed: +// LoadFunctionRow(alarmFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed)); +// break; +// case FunctionAttributeKey.Percent: +// LoadFunctionRow(alarmFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.Percent)); +// break; +// case FunctionAttributeKey.Brightness: +// LoadFunctionRow(alarmFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.Brightness)); +// break; +// case FunctionAttributeKey.FadeTime: +// LoadFunctionRow(alarmFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime)); +// break; +// } +// } + +// var bottomView = new FrameLayout() +// { +// Y = Application.GetRealHeight(591), +// Height = Application.GetRealHeight(106), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(16), +// }; +// bodyView.AddChidren(bottomView); + +// var btnConfrim = new Button() +// { +// Gravity = Gravity.CenterHorizontal, +// Y = Application.GetRealHeight(12), +// Width = Application.GetRealWidth(220), +// Height = Application.GetRealWidth(44), +// TextAlignment = TextAlignment.Center, +// TextColor = CSS_Color.MainBackgroundColor, +// BackgroundColor = CSS_Color.MainColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// IsBold = true, +// Radius = (uint)Application.GetRealWidth(22), +// TextID = StringId.Complete +// }; +// bottomView.AddChidren(btnConfrim); + +// btnConfrim.MouseUpEventHandler = (sender, e) => +// { +// }; +// } + + +// /// <summary> +// /// 鍔犺浇鍔熻兘Row +// /// </summary> +// void LoadFunctionRow(FunctionAttributes sceneStatus) +// { +// if (sceneStatus == null) +// return; +// #region Row code +// var row = new FrameLayout() +// { +// Height = Application.GetRealHeight(50), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// }; +// contentView.AddChidren(row); + + +// if (sceneStatus.key != FunctionAttributeKey.OnOff) +// { +// row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); +// } +// else +// { +// if (sceneStatus.state == "stop") +// { +// sceneStatus.state = "on"; +// } +// } +// Button btnRight = new Button() +// { +// X = Application.GetRealWidth(339), +// Gravity = Gravity.CenterVertical, +// Width = Application.GetMinRealAverage(16), +// Height = Application.GetMinRealAverage(16), +// UnSelectedImagePath = "Public/Right.png", +// }; +// row.AddChidren(btnRight); + + +// var showCode = ""; + +// var btnFunctionText = new Button() +// { +// Width = Application.GetRealWidth(330), +// TextAlignment = TextAlignment.CenterRight, +// TextColor = CSS_Color.PromptingColor1, +// TextSize = CSS_FontSize.PromptFontSize_FirstLevel, +// Text = sceneFunctionStatus.GetValueText(showCode) + sceneFunctionStatus.GetUintString() +// }; +// row.AddChidren(btnFunctionText); + + + +// if (sceneStatus.key == FunctionAttributeKey.OnOff) +// { +// btnOnText = btnFunctionText; +// } +// else if (sceneStatus.key == FunctionAttributeKey.Brightness || sceneStatus.key == FunctionAttributeKey.Percent) +// { +// btnBrightnessText = btnFunctionText; +// } + +// var btnFunctionName = new Button() +// { +// X = Application.GetRealWidth(16), +// TextAlignment = TextAlignment.CenterLeft, +// TextColor = CSS_Color.FirstLevelTitleColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// Text = sceneStatus.GetNameText() +// }; +// row.AddChidren(btnFunctionName); +// btnFunctionName.MouseUpEventHandler = (sender, e) => +// { +// switch (sceneStatus.key) +// { +// case FunctionAttributeKey.OnOff: +// LoadEditDialog_OnOff(sceneStatus, btnFunctionText); +// break; +// case FunctionAttributeKey.Brightness: +// LoadEditDialog_Percent(sceneStatus, btnFunctionText); +// break; +// case FunctionAttributeKey.Mode: +// var statusList = new List<string>(); +// var tr = alarmFunction.localFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.Mode); +// foreach (var t in tr.value) +// { +// statusList.Add(t); +// } +// LoadEditDialog_FunctionPar(sceneStatus, btnFunctionText, statusList); +// break; +// case FunctionAttributeKey.FanSpeed: +// var fanStatusList = new List<string>(); +// var tr1 = alarmFunction.localFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); +// foreach (var t in tr1.value) +// { +// fanStatusList.Add(t); +// } +// LoadEditDialog_FunctionPar(sceneStatus, btnFunctionText, fanStatusList); +// break; +// case FunctionAttributeKey.SetTemp: +// LoadEditDialog_Temp(sceneStatus, btnFunctionText); +// break; +// case FunctionAttributeKey.FadeTime: + +// break; +// case "cct": +// break; +// case FunctionAttributeKey.Percent: +// LoadEditDialog_Percent(sceneStatus, btnFunctionText); +// break; +// } +// }; + +// #endregion +// } + + + +// #region 灞炴�ч�夋嫨寮圭獥 +// /// <summary> +// /// 鍔犺浇寮�鍏抽�夋嫨寮圭獥 +// /// </summary> +// /// <param name="function"></param> +// /// <param name="btn"></param> +// void LoadEditDialog_OnOff(SceneFunctionStatus trait, Button btn) +// { +// Dialog dialog = new Dialog(); + +// var pView = new FrameLayout() +// { +// BackgroundColor = CSS_Color.DialogTransparentColor1, +// }; +// dialog.AddChidren(pView); + +// var optionBaseView = new FrameLayout() +// { +// Y = Application.GetRealHeight(500), +// Height = Application.GetRealHeight(160), +// AnimateSpeed = 0.3f, +// Animate = Animate.DownToUp, +// }; +// pView.AddChidren(optionBaseView); + +// var optionView = new VerticalScrolViewLayout() +// { +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(100), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// ScrollEnabled = false, +// }; +// optionBaseView.AddChidren(optionView); + +// var btnOn = new Button() +// { +// Height = Application.GetRealHeight(50), +// TextAlignment = TextAlignment.Center, +// TextColor = CSS_Color.TextualColor, +// SelectedTextColor = CSS_Color.MainColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// TextID = StringId.On, +// IsSelected = trait.value.ToString() == "on" +// }; +// optionView.AddChidren(btnOn); + +// optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + +// var btnOff = new Button() +// { +// Height = Application.GetRealHeight(50), +// TextAlignment = TextAlignment.Center, +// TextColor = CSS_Color.TextualColor, +// SelectedTextColor = CSS_Color.MainColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// TextID = StringId.OFF, +// IsSelected = trait.value.ToString() == "off" +// }; +// optionView.AddChidren(btnOff); + +// var btnCancel = new Button() +// { +// Gravity = Gravity.CenterHorizontal, +// Y = Application.GetRealHeight(8) + optionView.Bottom, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(50), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// TextID = StringId.Cancel, +// TextColor = CSS_Color.WarningColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// }; +// optionBaseView.AddChidren(btnCancel); + +// dialog.Show(); + +// pView.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// }; + +// btnCancel.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// }; +// btnOn.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// trait.value = "on"; +// alarmFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "on"; +// btn.Text = trait.GetValueText() + trait.GetUintString(); + +// var temp = alarmFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); +// if (temp == null) +// { +// temp = alarmFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent); +// } +// if (temp != null) +// { +// if (temp.value == "0") +// { +// temp.value = "100"; +// } +// btnBrightnessText.Text = temp.GetValueText() + "%"; +// } +// }; +// btnOff.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// trait.value = "off"; +// alarmFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "off"; +// btn.Text = trait.GetValueText() + trait.GetUintString(); + +// var temp = alarmFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); +// if (temp == null) +// { +// temp = alarmFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent); +// } +// if (temp != null) +// { +// if (temp.value != "0") +// { +// temp.value = "0"; +// } +// btnBrightnessText.Text = temp.GetValueText() + "%"; +// } +// }; + +// } + +// /// <summary> +// /// 鍔犺浇娓╁害閫夋嫨寮圭獥 +// /// </summary> +// /// <param name="function"></param> +// /// <param name="btn"></param> +// void LoadEditDialog_Temp(SceneFunctionStatus trait, Button btn) +// { +// double temp = 16; +// double.TryParse(trait.value, out temp); +// trait.value = temp.ToString(); + +// List<string> pickerItems = new List<string>(); +// if (trait == null) +// { +// return; +// } + +// Dialog dialog = new Dialog(); + +// var pView = new FrameLayout() +// { +// BackgroundColor = CSS_Color.DialogTransparentColor1, +// }; +// dialog.AddChidren(pView); + +// var optionBaseView = new FrameLayout() +// { +// Y = Application.GetRealHeight(456 - 60), +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(260), +// AnimateSpeed = 0.3f, +// Animate = Animate.DownToUp, +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// }; +// pView.AddChidren(optionBaseView); + +// var topView = new FrameLayout() +// { +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(40), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// }; +// optionBaseView.AddChidren(topView); +// topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + +// var btnCancel = new Button() +// { +// X = Application.GetRealWidth(21), +// Width = Application.GetRealWidth(100), +// TextAlignment = TextAlignment.CenterLeft, +// TextColor = CSS_Color.PromptingColor1, +// TextSize = CSS_FontSize.TextFontSize, +// TextID = StringId.Cancel, +// }; +// topView.AddChidren(btnCancel); + +// var btnConfrim = new Button() +// { +// Width = Application.GetRealWidth(320), +// TextAlignment = TextAlignment.CenterRight, +// TextColor = CSS_Color.MainColor, +// TextSize = CSS_FontSize.TextFontSize, +// TextID = StringId.Confirm, +// }; +// topView.AddChidren(btnConfrim); + +// UIPickerView uIPickerView = new UIPickerView() +// { +// Y = Application.GetRealHeight(40), +// Height = Application.GetRealHeight(210), +// Radius = (uint)Application.GetRealWidth(12), +// }; +// for (int i = 16; i <= 32; i += 1) +// { +// pickerItems.Add(i.ToString() + trait.GetUintString()); +// } +// uIPickerView.setNPicker(pickerItems, null, null); +// optionBaseView.AddChidren(uIPickerView); +// uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5); + +// string selectItem = pickerItems[0]; +// if (pickerItems.Contains(trait.value + trait.GetUintString())) +// { +// selectItem = trait.value.ToString() + trait.GetUintString(); +// } + +// dialog.Show(); + +// pView.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// }; + +// btnCancel.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// }; +// uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => { +// selectItem = pickerItems[int1]; +// }; +// btnConfrim.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// btn.Text = selectItem; +// //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ; +// trait.value = selectItem.Replace(trait.GetUintString(), ""); +// }; + +// } + +// /// <summary> +// /// 鍔犺浇浜害閫夋嫨寮圭獥 +// /// </summary> +// /// <param name="function"></param> +// /// <param name="btn"></param> +// void LoadEditDialog_Percent(SceneFunctionStatus trait, Button btn) +// { +// if (trait == null) +// { +// return; +// } + +// Dialog dialog = new Dialog(); + +// var pView = new FrameLayout() +// { +// BackgroundColor = CSS_Color.DialogTransparentColor1, +// }; +// dialog.AddChidren(pView); + +// var optionBaseView = new FrameLayout() +// { +// Y = Application.GetRealHeight(467), +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(180), +// AnimateSpeed = 0.3f, +// Animate = Animate.DownToUp, +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// }; +// pView.AddChidren(optionBaseView); + +// var topView = new FrameLayout() +// { +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(40), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// }; +// optionBaseView.AddChidren(topView); +// topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + +// var btnTitle = new Button() +// { +// Gravity = Gravity.CenterHorizontal, +// TextAlignment = TextAlignment.Center, +// Width = Application.GetRealWidth(100), +// Text = trait.GetNameText(), +// IsBold = true, +// TextColor = CSS_Color.FirstLevelTitleColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// }; +// topView.AddChidren(btnTitle); + +// var btnCancel = new Button() +// { +// X = Application.GetRealWidth(21), +// Width = Application.GetRealWidth(100), +// TextAlignment = TextAlignment.CenterLeft, +// TextColor = CSS_Color.PromptingColor1, +// TextSize = CSS_FontSize.TextFontSize, +// TextID = StringId.Cancel, +// }; +// topView.AddChidren(btnCancel); + +// var btnConfrim = new Button() +// { +// Width = Application.GetRealWidth(320), +// TextAlignment = TextAlignment.CenterRight, +// TextColor = CSS_Color.MainColor, +// TextSize = CSS_FontSize.TextFontSize, +// TextID = StringId.Confirm, +// }; +// topView.AddChidren(btnConfrim); + +// Button btnMinusSignIcon = new Button() +// { +// X = Application.GetRealWidth(26), +// Y = Application.GetRealHeight(118), +// Width = Application.GetMinRealAverage(24), +// Height = Application.GetMinRealAverage(24), +// UnSelectedImagePath = "Public/MinusSignIcon.png", +// }; +// optionBaseView.AddChidren(btnMinusSignIcon); + +// DiyImageSeekBar controlBar = new DiyImageSeekBar() +// { +// X = btnMinusSignIcon.Right + Application.GetRealWidth(12), +// Y = Application.GetRealHeight(100),//414,璁捐鏁版嵁 +// Width = Application.GetRealWidth(220), +// Height = Application.GetRealHeight(54), +// SeekBarViewHeight = Application.GetRealHeight(8), +// ThumbImagePath = "Public/ThumbImage.png", +// ThumbImageHeight = Application.GetRealHeight(54), +// ProgressBarColor = CSS_Color.MainColor, +// ProgressTextColor = CSS_Color.FirstLevelTitleColor, +// ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, +// MaxValue = 100, +// Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32(trait.value.Replace("{}", "")), +// SeekBarPadding = Application.GetRealWidth(20), +// }; +// optionBaseView.AddChidren(controlBar); + +// Button btnPlusSgnIcon = new Button() +// { +// X = controlBar.Right + Application.GetRealWidth(12), +// Y = Application.GetRealHeight(118), +// Width = Application.GetMinRealAverage(24), +// Height = Application.GetMinRealAverage(24), +// UnSelectedImagePath = "Public/PlusSignIcon.png", +// }; +// optionBaseView.AddChidren(btnPlusSgnIcon); + +// btnMinusSignIcon.MouseUpEventHandler = (sender, e) => +// { +// controlBar.Progress--; +// }; +// btnPlusSgnIcon.MouseUpEventHandler = (sender, e) => +// { +// controlBar.Progress++; +// }; + +// dialog.Show(); +// pView.MouseUpEventHandler = (sender, e) => +// { +// dialog.Close(); +// }; + +// btnCancel.MouseUpEventHandler = (sender, e) => +// { +// dialog.Close(); +// }; +// btnConfrim.MouseUpEventHandler = (sender, e) => +// { +// dialog.Close(); +// trait.value = controlBar.Progress.ToString(); +// btn.Text = trait.value + trait.GetUintString(); + +// var temp = alarmFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff); +// if (temp != null) +// { +// if (controlBar.Progress > 0) +// { +// temp.value = "on"; +// } +// else +// { +// temp.value = "off"; +// } +// btnOnText.Text = temp.GetValueText(); +// } +// }; +// } + + +// /// <summary> +// /// 鍔犺浇鍙樺寲閫熷害閫夋嫨寮圭獥 +// /// </summary> +// /// <param name="function"></param> +// /// <param name="btn"></param> +// void LoadEditDialog_FadeTime(SceneFunctionStatus trait, Button btn) +// { +// if (trait == null) +// { +// return; +// } + +// Dialog dialog = new Dialog(); + +// var pView = new FrameLayout() +// { +// BackgroundColor = CSS_Color.DialogTransparentColor1, +// }; +// dialog.AddChidren(pView); + +// var optionBaseView = new FrameLayout() +// { +// Y = Application.GetRealHeight(467), +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(180), +// AnimateSpeed = 0.3f, +// Animate = Animate.DownToUp, +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// }; +// pView.AddChidren(optionBaseView); + +// var topView = new FrameLayout() +// { +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(40), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// }; +// optionBaseView.AddChidren(topView); +// topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + +// var btnTitle = new Button() +// { +// Gravity = Gravity.CenterHorizontal, +// TextAlignment = TextAlignment.Center, +// Width = Application.GetRealWidth(100), +// Text = trait.GetNameText(), +// IsBold = true, +// TextColor = CSS_Color.FirstLevelTitleColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// }; +// topView.AddChidren(btnTitle); + +// var btnCancel = new Button() +// { +// X = Application.GetRealWidth(21), +// Width = Application.GetRealWidth(100), +// TextAlignment = TextAlignment.CenterLeft, +// TextColor = CSS_Color.PromptingColor1, +// TextSize = CSS_FontSize.TextFontSize, +// TextID = StringId.Cancel, +// }; +// topView.AddChidren(btnCancel); + +// var btnConfrim = new Button() +// { +// Width = Application.GetRealWidth(320), +// TextAlignment = TextAlignment.CenterRight, +// TextColor = CSS_Color.MainColor, +// TextSize = CSS_FontSize.TextFontSize, +// TextID = StringId.Confirm, +// }; +// topView.AddChidren(btnConfrim); + +// Button btnMinusSignIcon = new Button() +// { +// X = Application.GetRealWidth(26), +// Y = Application.GetRealHeight(118), +// Width = Application.GetMinRealAverage(24), +// Height = Application.GetMinRealAverage(24), +// Text = "0s", +// TextColor = CSS_Color.PromptingColor1, +// TextSize = CSS_FontSize.PromptFontSize_FirstLevel, +// }; +// optionBaseView.AddChidren(btnMinusSignIcon); + +// DiyImageSeekBar controlBar = new DiyImageSeekBar() +// { +// X = btnMinusSignIcon.Right + Application.GetRealWidth(12), +// Y = Application.GetRealHeight(100),//414,璁捐鏁版嵁 +// Width = Application.GetRealWidth(220), +// Height = Application.GetRealHeight(54), +// SeekBarViewHeight = Application.GetRealHeight(8), +// ThumbImagePath = "Public/ThumbImage.png", +// ThumbImageHeight = Application.GetRealHeight(54), +// ProgressBarColor = CSS_Color.MainColor, +// ProgressTextColor = CSS_Color.FirstLevelTitleColor, +// ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, +// MaxValue = 100, +// Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32(trait.value.Replace("{}", "")), +// SeekBarPadding = Application.GetRealWidth(20), +// }; +// optionBaseView.AddChidren(controlBar); + +// Button btnPlusSgnIcon = new Button() +// { +// X = controlBar.Right + Application.GetRealWidth(12), +// Y = Application.GetRealHeight(118), +// Width = Application.GetMinRealAverage(24), +// Height = Application.GetMinRealAverage(24), +// Text = "10s", +// TextColor = CSS_Color.PromptingColor1, +// TextSize = CSS_FontSize.PromptFontSize_FirstLevel, +// }; +// optionBaseView.AddChidren(btnPlusSgnIcon); + +// btnMinusSignIcon.MouseUpEventHandler = (sender, e) => +// { +// controlBar.Progress--; +// }; +// btnPlusSgnIcon.MouseUpEventHandler = (sender, e) => +// { +// controlBar.Progress++; +// }; + +// dialog.Show(); +// pView.MouseUpEventHandler = (sender, e) => +// { +// dialog.Close(); +// }; + +// btnCancel.MouseUpEventHandler = (sender, e) => +// { +// dialog.Close(); +// }; +// btnConfrim.MouseUpEventHandler = (sender, e) => +// { +// dialog.Close(); +// trait.value = controlBar.Progress.ToString(); +// btn.Text = trait.value + trait.GetUintString(); +// }; +// } + + +// /// <summary> +// /// 鍔犺浇鍔熻兘灞炴�ф暟鎹�夋嫨寮圭獥 +// /// </summary> +// void LoadEditDialog_FunctionPar(SceneFunctionStatus trait, Button btn, List<string> statusList) +// { +// Button lastButton = new Button(); +// var lastData = ""; +// var lastText = ""; +// Dialog dialog = new Dialog(); + +// if (DB_ResidenceData.Instance.GatewayType == 0) +// { +// if (SPK.AcSpkList().Contains(alarmFunction.localFunction.spk)) +// { +// //0 鍒跺喎1鍒剁儹锛�2閫氶锛�3鑷姩锛�4闄ゆ箍 +// for (int i = 0; i < statusList.Count; i++) +// { +// if (statusList[i] == "0") +// { +// statusList[i] = "cool"; +// } +// else if (statusList[i] == "1") +// { +// statusList[i] = "heat"; +// } +// else if (statusList[i] == "2") +// { +// statusList[i] = "fan"; +// } +// else if (statusList[i] == "3") +// { +// statusList[i] = "auto"; +// } +// else if (statusList[i] == "4") +// { +// statusList[i] = "dry"; +// } +// } +// } +// else if (SPK.FhSpkList().Contains(alarmFunction.localFunction.spk)) +// { +// //1:鏅��,2:鐧藉ぉ,3:澶滄櫄,4:绂诲紑,5:鏃堕棿 +// for (int i = 0; i < statusList.Count; i++) +// { +// if (statusList[i] == "5") +// { +// statusList[i] = "timer"; +// } +// else if (statusList[i] == "1") +// { +// statusList[i] = "normal"; +// } +// else if (statusList[i] == "2") +// { +// statusList[i] = "day"; +// } +// else if (statusList[i] == "3") +// { +// statusList[i] = "night"; +// } +// else if (statusList[i] == "4") +// { +// statusList[i] = "away"; +// } +// } + +// } +// } + +// var pView = new FrameLayout() +// { +// BackgroundColor = CSS_Color.DialogTransparentColor1, +// }; +// dialog.AddChidren(pView); + +// var optionBaseView = new FrameLayout() +// { +// Y = Application.GetRealHeight(579 - 50 * statusList.Count), +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(50 * statusList.Count + 50), +// AnimateSpeed = 0.3f, +// Animate = Animate.DownToUp, +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// }; +// pView.AddChidren(optionBaseView); + +// var topView = new FrameLayout() +// { +// Gravity = Gravity.CenterHorizontal, +// Width = Application.GetRealWidth(343), +// Height = Application.GetRealHeight(50), +// BackgroundColor = CSS_Color.MainBackgroundColor, +// Radius = (uint)Application.GetRealWidth(12), +// }; +// optionBaseView.AddChidren(topView); + +// var btnTitle = new Button() +// { +// Gravity = Gravity.CenterHorizontal, +// TextAlignment = TextAlignment.Center, +// Width = Application.GetRealWidth(100), +// Text = trait.GetNameText(), +// IsBold = true, +// TextColor = CSS_Color.FirstLevelTitleColor, +// TextSize = CSS_FontSize.SubheadingFontSize, +// }; +// topView.AddChidren(btnTitle); + +// var btnCancel = new Button() +// { +// X = Application.GetRealWidth(21), +// Width = Application.GetRealWidth(100), +// TextAlignment = TextAlignment.CenterLeft, +// TextColor = CSS_Color.PromptingColor1, +// TextSize = CSS_FontSize.TextFontSize, +// TextID = StringId.Cancel, +// }; +// topView.AddChidren(btnCancel); + +// var btnConfrim = new Button() +// { +// Width = Application.GetRealWidth(320), +// TextAlignment = TextAlignment.CenterRight, +// TextColor = CSS_Color.MainColor, +// TextSize = CSS_FontSize.TextFontSize, +// TextID = StringId.Complete, +// }; +// topView.AddChidren(btnConfrim); +// int hei = 1; +// foreach (var m in statusList) +// { +// var row = new FrameLayout() +// { +// Y = Application.GetRealHeight(50 * hei), +// Height = Application.GetRealHeight(50), +// }; +// optionBaseView.AddChidren(row); +// if (statusList.Count > hei) +// { +// optionBaseView.AddChidren(new Button() +// { +// Gravity = Gravity.CenterHorizontal, +// Y = row.Bottom, +// Width = Application.GetRealWidth(343), +// BackgroundColor = CSS_Color.DividingLineColor, +// Height = 1, +// }); +// } +// hei++; + +// var btnChoose = new Button() +// { +// X = Application.GetRealWidth(303), +// Gravity = Gravity.CenterVertical, +// Width = Application.GetMinRealAverage(28), +// Height = Application.GetMinRealAverage(28), +// UnSelectedImagePath = "Public/ChooseIcon.png", +// SelectedImagePath = "Public/ChooseOnIcon.png", + +// }; +// row.AddChidren(btnChoose); +// if (trait.value == m) +// { +// lastButton = btnChoose; +// btnChoose.IsSelected = true; +// } +// var btnPropertyTitle = new Button() +// { +// X = Application.GetRealWidth(16), +// TextAlignment = TextAlignment.CenterLeft, +// TextColor = CSS_Color.FirstLevelTitleColor, +// TextSize = CSS_FontSize.TextFontSize, +// Tag = m, +// Text = trait.GetValueText(m) +// }; +// row.AddChidren(btnPropertyTitle); + +// btnPropertyTitle.MouseUpEventHandler = (sender, e) => { +// btnChoose.IsSelected = true; +// if (lastButton != null) +// { +// lastButton.IsSelected = false; +// } +// lastButton = btnChoose; +// lastData = btnPropertyTitle.Tag.ToString(); +// lastText = btnPropertyTitle.Text; +// }; +// } + + + + +// dialog.Show(); + +// pView.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// }; + +// btnCancel.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// }; +// btnConfrim.MouseUpEventHandler = (sender, e) => { +// dialog.Close(); +// trait.value = lastData; +// //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.curValue.ToString() ; +// btn.Text = lastText; +// }; + +// } + +// #endregion + +// } +//} diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs index 6ab343a..a883705 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -10,6 +11,11 @@ /// 涓荤獥浣� /// </summary> FrameLayout bodyView; + /// <summary> + /// 鑷畾涔夊竷闃插尯鍩� + /// </summary> + HorizontalScrolViewLayout customDeploymentView; + public ArmCenterPage() { bodyView = this; @@ -53,6 +59,33 @@ Height = Application.GetRealWidth(16), }); + + #region 鎾ら槻鍖哄煙 + var disarmView = new FrameLayout() + { + Height = 0, + }; + contentView.AddChidren(disarmView); + + var btnDisarm = new Button() + { + Width = Application.GetRealWidth(120), + Height = Application.GetRealHeight(44), + BackgroundColor = CSS_Color.WarningColor, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + Text = "鎾ら槻" + }; + disarmView.AddChidren(btnDisarm); + btnDisarm.MouseUpEventHandler = (sender, e) => { + if (SecurityCenter.Security.CurrentDefenseMode != null) + { + Control.Ins.ControlSecurity(SecurityCenter.Security.CurrentDefenseMode, "disable"); + } + }; + + #endregion + #region 鑷畾涔夊竷闃� //鑷畾涔夊竷闃叉爣棰� Button btnCustomDeploymentTitle = new Button() @@ -67,7 +100,7 @@ }; contentView.AddChidren(btnCustomDeploymentTitle); - HorizontalScrolViewLayout customDeploymentView = new HorizontalScrolViewLayout() + customDeploymentView = new HorizontalScrolViewLayout() { X = Application.GetRealWidth(23), Height = Application.GetRealWidth(80), @@ -75,28 +108,9 @@ }; contentView.AddChidren(customDeploymentView); - //customDeploymentView.AddChidren(new Button() - //{ - // Width = Application.GetRealWidth(23), - //}); - var view = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png", - Language.StringByID(StringId.HouseDefense)); - customDeploymentView.AddChidren(view); - EventHandler<MouseEventArgs> event1 = (sender, e) => - { - ShowArmDialog(new SecurityAlarm()); - }; - view.SetClickEvent(event1); - + iniCustomDeploymentView(); - if(FunctionList.List.securities.Count>3) - { - customDeploymentView.ScrollEnabled = true; - } - foreach (var mode in FunctionList.List.securities) - { - } #endregion contentView.AddChidren(new Button() @@ -104,6 +118,8 @@ Height = Application.GetRealHeight(20), }); + #region 鍥哄畾甯冮槻鍖哄煙 + /* var fixedDeploymentView = new FrameLayout() { Height = Application.GetRealHeight(133), @@ -134,7 +150,6 @@ }; fixedDeploymentView.AddChidren(btnFixedDeploymentTip); - //鍥哄畾甯冮槻鍖哄煙 var fixedDeploymentTypeView = new HorizontalScrolViewLayout() { Y = btnFixedDeploymentTip.Bottom + Application.GetRealHeight(15), @@ -148,7 +163,7 @@ Width = Application.GetRealWidth(24), }); - + #endregion //鐏惧鎶ヨ @@ -163,10 +178,57 @@ //闃茬洍鎶ヨ var burglarAlarmView = new FixedArmView("FunctionIcon/ArmCenter/BurglarAlarmIcon.png", Language.StringByID(StringId.BurglarAlarm), Language.StringByID(StringId.AlarmMute)); fixedDeploymentTypeView.AddChidren(burglarAlarmView); + */ + #endregion + + + + + + } + /// <summary> + /// 鍒濆鍖栬嚜瀹氫箟甯冮槻鍖哄煙 + /// </summary> + private void iniCustomDeploymentView() + { + customDeploymentView.RemoveAll(); + foreach (var mode in FunctionList.List.securities) + { + var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png", + mode.name); + customDeploymentView.AddChidren(armDiyView); + EventHandler<MouseEventArgs> event2 = (sender, e) => + { + ShowArmDialog(mode); + }; + armDiyView.SetClickEvent(event2); + } + + if (FunctionList.List.securities.Count < 4) + { + var view = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png", + Language.StringByID(StringId.Custom)); + customDeploymentView.AddChidren(view); + EventHandler<MouseEventArgs> event1 = (sender, e) => + { + Action refreshAction = () => + { + iniCustomDeploymentView(); + }; + + var addDefensePage = new AddAlarmDeploymentPage(new SecurityAlarm(), refreshAction); + MainPage.BasePageView.AddChidren(addDefensePage); + addDefensePage.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + view.SetClickEvent(event1); + } + + } private void ShowArmDialog(SecurityAlarm alarm) { @@ -231,10 +293,19 @@ dialog.Show(); + btnOpen.MouseUpEventHandler = (sender, e) => { + Control.Ins.ControlSecurity(alarm, "enable"); + dialog.Close(); + }; + btnCheckModify.MouseUpEventHandler = (sender, e) => { dialog.Close(); - var armSetPage = new ArmDeploymentSettingPage(alarm); + Action refreshAction = () => + { + iniCustomDeploymentView(); + }; + var armSetPage = new ArmDeploymentSettingPage(alarm,refreshAction); MainPage.BasePageView.AddChidren(armSetPage); armSetPage.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs index cb86ac7..5de018c 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs @@ -9,12 +9,28 @@ public class ArmDeploymentSettingPage : FrameLayout { FrameLayout bodyView; - SecurityAlarm securityAlarm; + /// <summary> + /// 涓婚鐣岄潰 + /// </summary> + VerticalScrolViewLayout contentView; + /// <summary> + /// 杈撳叆鏉′欢鍒楄〃鍖哄煙鐣岄潰 + /// </summary> + VerticalScrolViewLayout inputTargetView; + /// <summary> + /// 鍛婅鐩爣鍒楄〃鍖哄煙鐣岄潰 + /// </summary> + VerticalScrolViewLayout outputTargetView; - public ArmDeploymentSettingPage(SecurityAlarm alarm ) + + SecurityAlarm securityAlarm; + Action refreshAction; + + public ArmDeploymentSettingPage(SecurityAlarm alarm, Action action) { bodyView = this; securityAlarm = alarm; + refreshAction = action; } public void LoadPage() @@ -23,10 +39,10 @@ bodyView.BackgroundColor = CSS_Color.BackgroundColor; - VerticalScrolViewLayout contentView = new VerticalScrolViewLayout() + contentView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(667 - 64), + Height = Application.GetRealHeight(527), }; bodyView.AddChidren(contentView); @@ -86,54 +102,156 @@ LoadEvent_EditSecurityAlarmName(btnDeploymentName); #endregion + /* #region 瑙﹀彂寤舵椂 - //var delayedRow = new FrameLayout() - //{ - // Height = Application.GetRealHeight(50), - // BackgroundColor = CSS_Color.MainBackgroundColor, - //}; - //contentView.AddChidren(delayedRow); + var delayedRow = new FrameLayout() + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(delayedRow); - //var btnDelayedTitle = new Button() - //{ - // X = Application.GetRealWidth(16), - // Width = Application.GetRealWidth(72), - // TextAlignment = TextAlignment.CenterLeft, - // TextColor = CSS_Color.FirstLevelTitleColor, - // TextSize = CSS_FontSize.TextFontSize, - // TextID = StringId.Name, - //}; - //delayedRow.AddChidren(btnDelayedTitle); + var btnDelayedTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(72), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.TriggerDelay, + }; + delayedRow.AddChidren(btnDelayedTitle); + btnDelayedTitle.Text += ":"; - //var btnDelayedText = new Button() - //{ - // X = Application.GetRealWidth(88), - // Width = Application.GetRealWidth(230), - // TextAlignment = TextAlignment.CenterLeft, - // TextColor = CSS_Color.TextualColor, - // TextSize = CSS_FontSize.TextFontSize, - // Text = securityAlarm.name - //}; - //delayedRow.AddChidren(btnDelayedText); + var btnDelayedText = new Button() + { + X = Application.GetRealWidth(88), + Width = Application.GetRealWidth(230), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + Text = securityAlarm.name + }; + delayedRow.AddChidren(btnDelayedText); - //var btnDelayedRight = new Button() - //{ - // X = Application.GetRealWidth(343), - // Gravity = Gravity.CenterVertical, - // Width = Application.GetMinRealAverage(16), - // Height = Application.GetMinRealAverage(16), - // UnSelectedImagePath = "Public/RightIcon.png", - //}; - //delayedRow.AddChidren(btnDelayedRight); + var btnDelayedRight = new Button() + { + X = Application.GetRealWidth(343), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/RightIcon.png", + }; + delayedRow.AddChidren(btnDelayedRight); - ////delayedRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); - //LoadEvent_EditSecurityAlarmName(btnDelayedTitle); + //delayedRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); #endregion + */ #endregion contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); - #region 甯冮槻鍔熻兘\鎶ヨ鐘舵�� + //甯冮槻鍔熻兘 + iniDefenseView(); + //鍛婅鐩爣 + iniAlarmView(); + + #region 搴曢儴鍖哄煙 + var bottomView = new FrameLayout() + { + Y = Application.GetRealHeight(591), + Height = Application.GetRealHeight(100), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(22), + }; + this.AddChidren(bottomView); + + var btnConfrim = new Button() + { + X = Application.GetRealWidth(78), + Y = Application.GetRealHeight(12), + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + Radius = (uint)Application.GetRealWidth(22), + BackgroundColor = CSS_Color.MainColor, + TextID = StringId.Confirm, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + TextAlignment = TextAlignment.Center, + }; + bottomView.AddChidren(btnConfrim); + + btnConfrim.MouseUpEventHandler = (sender, e) => + { + if (securityAlarm.input.Count == 0) + { + var tip = new Tip() + { + Text = "璇烽�夋嫨甯冮槻鐩爣", + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(MainPage.BaseView); + return; + } + if (securityAlarm.output.Count == 0) + { + var tip = new Tip() + { + Text = "璇烽�夋嫨鍛婅鐩爣", + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(MainPage.BaseView); + + return; + } + + var waitPage = new Loading(); + waitPage.Start(); + new System.Threading.Thread(() => + { + try + { + var code = securityAlarm.SaveInfo(); + if (code == StateCode.SUCCESS) + { + SecurityCenter.Security.GetSecurityAlarmList(); + Application.RunOnMainThread(() => + { + this.RemoveFromParent(); + refreshAction?.Invoke(); + }); + } + else + { + Application.RunOnMainThread(() => + { + IMessageCommon.Current.ShowErrorInfoAlter(code); + }); + } + } + catch { } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + }; + #endregion + + } + + /// <summary> + /// 鍒濆鍖栭儴鍒嗗姛鑳藉尯鍩� + /// </summary> + private void iniDefenseView() + { + + #region 甯冮槻鍔熻兘 var deploymentFunctionRow = new FrameLayout() { Height = Application.GetRealHeight(44), @@ -161,24 +279,80 @@ UnSelectedImagePath = "FunctionIcon/ArmCenter/AddTargetIcon.png", }; deploymentFunctionRow.AddChidren(btnAddTarget); + ///娣诲姞杈撳叆鐩爣 + btnAddTarget.MouseUpEventHandler = (sender, e) => { + Action<SecurityAlarm> action = (outTemp) => { + securityAlarm = outTemp; + iniInputTargetView(); + }; + var page = new AddInputPage(securityAlarm, action); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; deploymentFunctionRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); - var inputTargetView = new VerticalScrolViewLayout() + inputTargetView = new VerticalScrolViewLayout() { ScrollEnabled = false, }; contentView.AddChidren(inputTargetView); - foreach (var target in securityAlarm.input) - { - inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName())); - } - inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count); + + iniInputTargetView(); #endregion contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); + } + /// <summary> + /// 鍒濆鍖栬緭鍏ユ潯浠跺尯鍩熺晫闈� + /// </summary> + /// <param name=""></param> + private void iniInputTargetView() + { + inputTargetView.RemoveAll(); + if (securityAlarm.input.Count > 0) + { + foreach (var target in securityAlarm.input) + { + inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName(), target.StateText())); + } + inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count); + //if (outputTargetView != null) + //{ + // contentView.AddChidren(outputTargetView); + //} + } + else + { + inputTargetView.AddChidren(new Button() + { + Height = Application.GetRealHeight(65), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + TextID = StringId.ThereIsNoAssociatedTaskDeploymentStatus, + IsMoreLines = true, + BackgroundColor = CSS_Color.MainBackgroundColor, + }); + + inputTargetView.Height = Application.GetRealHeight(68); + //if(outputTargetView!= null) + //{ + // contentView.AddChidren(outputTargetView); + //} + } + + + } + + /// <summary> + /// 鍒濆鍖栧憡璀︾洰鏍囧尯鍩� + /// </summary> + private void iniAlarmView() + { #region 鍛婅鐩爣 var outputRow = new FrameLayout() { @@ -207,22 +381,63 @@ UnSelectedImagePath = "FunctionIcon/ArmCenter/AddTargetIcon.png", }; outputRow.AddChidren(btnAddOutTarget); + + btnAddOutTarget.MouseUpEventHandler = (sender, e) => { + Action<SecurityAlarm> action = (outTemp) => { + securityAlarm = outTemp; + iniAlarmListView(); + }; + var page = new AddOutputPage(securityAlarm, action); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + outputRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); - var outputTargetView = new VerticalScrolViewLayout() + outputTargetView = new VerticalScrolViewLayout() { ScrollEnabled = false, }; contentView.AddChidren(outputTargetView); - foreach(var outTarget in securityAlarm.output) - { - inputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(),"")); - } - outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); + + iniAlarmListView(); + #endregion + contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); } + + /// <summary> + /// 鍒濆鍖栧憡璀﹀垪琛ㄥ尯鍩� + /// </summary> + private void iniAlarmListView() + { + outputTargetView.RemoveAll(); + if (securityAlarm.output.Count > 0) + { + foreach (var outTarget in securityAlarm.output) + { + outputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(), "鎵撳紑")); + } + outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); + } + else + { + outputTargetView.AddChidren(new Button() + { + Height = Application.GetRealHeight(65), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + TextID = StringId.ThereIsNoAssociatedTaskDeploymentStatus, + IsMoreLines = true, + BackgroundColor = CSS_Color.MainBackgroundColor, + }); + } + } + /// <summary> /// 淇敼瀹夐槻鍚嶇О @@ -233,174 +448,65 @@ { Action<string> callBack = (str) => { - var waitPage = new Loading(); - bodyView.AddChidren(waitPage); - waitPage.Start(Language.StringByID(StringId.PleaseWait)); - new System.Threading.Thread(() => + //鍚嶇О涓嶈兘涓虹┖ + if (string.IsNullOrEmpty(str)) { - try + new Tip() { - securityAlarm.name = str; - var responsePack = new HttpServerRequest().EditSecurity(new List<SecurityAlarm>() { securityAlarm}); + CloseTime = 1, + Text = Language.StringByID(StringId.NameCannotBeEmpty), + Direction = AMPopTipDirection.None, + }.Show(bodyView); + return; + } - if (responsePack.Code == StateCode.SUCCESS) - { - Application.RunOnMainThread(() => - { - btnDeploymentName.Text = str; - }); - } - else - { - IMessageCommon.Current.ShowErrorInfoAlter(responsePack.Code); - } - } - catch (Exception ex) - { - MainPage.Log($"update user name error : {ex.Message}"); - } - finally - { - Application.RunOnMainThread(() => - { - if (waitPage != null) - { - waitPage.RemoveFromParent(); - waitPage = null; - } - }); - } - }) - { IsBackground = true }.Start(); + + btnDeploymentName.Text = securityAlarm.name = str; + + //var waitPage = new Loading(); + //bodyView.AddChidren(waitPage); + //waitPage.Start(Language.StringByID(StringId.PleaseWait)); + //new System.Threading.Thread(() => + //{ + // try + // { + // securityAlarm.name = str; + // var responsePack = new HttpServerRequest().EditSecurity(new List<SecurityAlarm>() { securityAlarm}); + // if (responsePack.Code == StateCode.SUCCESS) + // { + // Application.RunOnMainThread(() => + // { + // btnDeploymentName.Text = str; + // }); + // } + // else + // { + // IMessageCommon.Current.ShowErrorInfoAlter(responsePack.Code); + // } + // } + // catch (Exception ex) + // { + // MainPage.Log($"update user name error : {ex.Message}"); + // } + // finally + // { + // Application.RunOnMainThread(() => + // { + // if (waitPage != null) + // { + // waitPage.RemoveFromParent(); + // waitPage = null; + // } + // }); + // } + //}) + //{ IsBackground = true }.Start(); }; new PublicAssmebly().LoadDialog_EditParater(StringId.Name, securityAlarm.name, callBack, StringId.NameCannotBeEmpty, 0, new List<string>()); }; btnDeploymentName.MouseUpEventHandler = eventHandler; } - } - /// <summary> - /// 杈撳叆鏉′欢琛屾帶浠� - /// </summary> - public class InputRow : RowLayout - { - Button btnTitle; - - Button btnSubTitle; - - public InputRow(string title,string subtitle) - { - this.LineColor = 0x00000000; - this.Height = Application.GetRealHeight(65); - this.BackgroundColor = CSS_Color.MainBackgroundColor; - - btnTitle = new Button() - { - X = Application.GetRealWidth(16), - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(320), - Text = title, - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - }; - this.AddChidren(btnTitle); - - btnSubTitle = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(24), - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(320), - Text = subtitle, - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - }; - this.AddChidren(btnSubTitle); - - } - - public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) - { - this.MouseUpEventHandler = eventHandler; - btnTitle.MouseUpEventHandler = eventHandler; - btnSubTitle.MouseUpEventHandler = eventHandler; - } - } - - /// <summary> - /// 杈撳嚭鏉′欢鎺т欢 - /// </summary> - public class OutputRow : RowLayout - { - Button btnTitle; - - Button btnSubTitle; - - Button btnState; - - Button btnRightIcon; - - public OutputRow(string title, string subtitle,string state) - { - this.LineColor = 0x00000000; - this.Height = Application.GetRealHeight(65); - this.BackgroundColor = CSS_Color.MainBackgroundColor; - - btnTitle = new Button() - { - X = Application.GetRealWidth(16), - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(320), - Text = title, - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - }; - this.AddChidren(btnTitle); - - btnSubTitle = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(24), - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(320), - Text = subtitle, - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - }; - this.AddChidren(btnSubTitle); - - btnState = new Button() - { - Width = Application.GetRealWidth(323), - TextAlignment = TextAlignment.CenterRight, - TextSize = CSS_FontSize.TextFontSize, - TextColor = CSS_Color.PromptingColor1, - Text = state - }; - this.AddChidren(btnState); - - btnRightIcon = new Button() - { - X = Application.GetRealWidth(339), - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(16), - Height = Application.GetRealWidth(16), - UnSelectedImagePath = "FunctionIcon/ArmCenter/RightIcon.png", - }; - this.AddChidren(btnRightIcon); - } - - public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) - { - btnState.MouseUpEventHandler = eventHandler; - btnTitle.MouseUpEventHandler = eventHandler; - btnSubTitle.MouseUpEventHandler = eventHandler; - } - } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs index 37d1cfa..d46bdd0 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs @@ -310,6 +310,7 @@ System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.RGB, lightTemp.GetRGBcolorString(function)); Control.Ins.SendWriteCommand(function, d); + lastColor = new byte[] { 255, 255, 255 }; }; } -- Gitblit v1.8.0