From ec1d7cb35b99f01be0151c5b6f0c0fc2fa30ab95 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期六, 21 八月 2021 17:44:09 +0800 Subject: [PATCH] 安防功能 --- HDL-ON_Android/Assets/Phone/PersonalCenter/ResidenceDefenseIcon.png | 0 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 10 HDL-ON_iOS/HDL-ON_iOS.csproj | 1 HDL_ON/Common/ApiUtlis.cs | 2 HDL_ON/Entity/Function/SecurityAlarm.cs | 146 ++------ HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs | 135 +++++++- HDL_ON/DAL/Mqtt/MqttClient.cs | 36 ++ HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs | 20 + HDL-ON_Android/HDL-ON_Android.csproj | 1 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 10 HDL-ON_iOS/Resources/Language.ini | 2 .vs/HDL_APP_Project/xs/UserPrefs.xml | 56 ++- HDL_ON/DAL/DriverLayer/Control.cs | 16 HDL-ON_iOS/Resources/Phone/PersonalCenter/ResidenceDefenseIcon.png | 0 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs | 77 ++++ HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 49 +++ HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 8 HDL_ON/Entity/FunctionList.cs | 20 HDL_ON/UI/UI0-Public/TopViewDiv.cs | 2 HDL_ON/DAL/Server/NewAPI.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 185 ++++++----- HDL_ON/Common/R.cs | 5 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs | 2 HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs | 4 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs | 67 ++-- 25 files changed, 551 insertions(+), 305 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index d959bc6..25016f6 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,50 +1,61 @@ 锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/Server/HttpUtil.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs"> <Files> - <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" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs" /> + <File FileName="HDL_ON/DAL/DriverLayer/UdpSocket.cs" /> + <File FileName="HDL_ON/Entity/FunctionList.cs" Line="435" Column="32" /> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs" Line="459" Column="40" /> + <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="295" Column="67" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs" Line="234" Column="1" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs" Line="29" Column="16" /> + <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="390" Column="52" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs" Line="154" Column="15" /> + <File FileName="HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs" Line="705" Column="5" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> - <Node name="Common" expanded="True" /> + <Node name="Common" expanded="True"> + <Node name="Utlis" expanded="True" /> + </Node> <Node name="DAL" expanded="True"> <Node name="DriverLayer" expanded="True" /> - <Node name="Server" expanded="True"> - <Node name="HttpUtil.cs" selected="True" /> - </Node> + <Node name="Mqtt" expanded="True" /> + <Node name="Server" expanded="True" /> </Node> <Node name="Entity" expanded="True"> <Node name="Function" expanded="True" /> </Node> <Node name="UI" expanded="True"> + <Node name="UI0-Public" expanded="True" /> <Node name="UI2" expanded="True"> <Node name="1-HomePage" expanded="True" /> + <Node name="2-Classification" expanded="True"> + <Node name="ClassificationPage.cs" selected="True" /> + </Node> + <Node name="4-PersonalCenter" expanded="True" /> <Node name="FuntionControlView" expanded="True"> <Node name="ArmCenter" 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="PersonalCenter" expanded="True" /> + </Node> + </Node> + </Node> <Node name="HDL-ON_iOS" expanded="True"> <Node name="Resources" expanded="True"> <Node name="Phone" expanded="True"> - <Node name="Collection" expanded="True" /> + <Node name="FunctionIcon" expanded="True"> + <Node name="ArmCenter" expanded="True" /> + </Node> </Node> </Node> </Node> @@ -64,15 +75,12 @@ <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/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/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="431" 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/PersonalCenter/ResidenceDefenseIcon.png b/HDL-ON_Android/Assets/Phone/PersonalCenter/ResidenceDefenseIcon.png new file mode 100644 index 0000000..23a63de --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PersonalCenter/ResidenceDefenseIcon.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index b89fd18..6a3c810 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -442,6 +442,7 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\SetLightSceneIcon.png" /> <AndroidAsset Include="Assets\Phone\Collection\DefenseStatusIcon.png" /> <AndroidAsset Include="Assets\Phone\Collection\DisarmStatusIcon.png" /> + <AndroidAsset Include="Assets\Phone\PersonalCenter\ResidenceDefenseIcon.png" /> </ItemGroup> <ItemGroup> <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\BindScene.png" /> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 2e079e1..8be2178 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1330,6 +1330,7 @@ <BundleResource Include="Resources\Phone\PersonalCenter\FacePassage\FaceIcon.png" /> <BundleResource Include="Resources\Phone\Collection\DefenseStatusIcon.png" /> <BundleResource Include="Resources\Phone\Collection\DisarmStatusIcon.png" /> + <BundleResource Include="Resources\Phone\PersonalCenter\ResidenceDefenseIcon.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index a2c3ac7..14e0b7c 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -486,6 +486,7 @@ 498=Trigger delay 499=Add defense function 500=Add alarm target +501=Security alarm: {0} is triggered. 1000=Room Humidity @@ -1581,6 +1582,7 @@ 498=瑙﹀彂寤舵椂 499=娣诲姞甯冮槻鍔熻兘 500=娣诲姞鍛婅鐩爣 +501=瀹夐槻鎶ヨ锛歿0}琚Е鍙戙�� 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL-ON_iOS/Resources/Phone/PersonalCenter/ResidenceDefenseIcon.png b/HDL-ON_iOS/Resources/Phone/PersonalCenter/ResidenceDefenseIcon.png new file mode 100644 index 0000000..23a63de --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PersonalCenter/ResidenceDefenseIcon.png Binary files differ diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 8ea5c0b..2c4449a 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -362,7 +362,7 @@ if (deviceResult.Code == StateCode.SUCCESS) { MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛"); - var packList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); + var packList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); foreach(var function in packList.list) { diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index a8f6fcb..7fad7c1 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -4,6 +4,11 @@ { public static class StringId { + + /// <summary> + /// 瀹夐槻鎶ヨ + /// </summary> + public const int SecurityAlarmTipString = 501; /// <summary> /// 娣诲姞鍛婅鐩爣 /// </summary> diff --git a/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs b/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs index dffe522..b6c1cb3 100644 --- a/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs +++ b/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs @@ -251,7 +251,7 @@ if (roomInfo.uid == this.nowShowSelectId) { btnFloorName.Text = roomInfo.floorName + roomInfo.roomName; - btnFloorName.Width = btnFloorName.GetTextWidth(); + //btnFloorName.Width = btnFloorName.GetTextWidth(); return; } } @@ -264,7 +264,7 @@ if (floorInfo.uid == this.nowShowSelectId) { btnFloorName.Text = floorInfo.roomName; - btnFloorName.Width = btnFloorName.GetTextWidth(); + //btnFloorName.Width = btnFloorName.GetTextWidth(); } } } diff --git a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs index 3292d0a..2201612 100644 --- a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs +++ b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs @@ -141,5 +141,25 @@ return $"/user/{Control.Ins.GatewayId}/custom/security/status/set"; } } + /// <summary> + /// 瀹夐槻鐘舵�佹洿鏂� + /// </summary> + public string SecurityStatusUp + { + get + { + return $"/user/{Control.Ins.GatewayId}/custom/security/status/up"; + }///user/1413055228417130497/custom/security/status/up + } + /// <summary> + /// 璇诲彇瀹夐槻鐘舵�佷俊鎭� + /// </summary> + public string ReadSecurityStatus + { + get + { + return $"/user/{Control.Ins.GatewayId}/custom/security/list/get"; + } + } } } \ No newline at end of file diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index b72b210..bdbbe68 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -779,12 +779,24 @@ //TODO 鏆傛椂涓嶄紶姝g‘鐨勬暟鎹笂鍘伙紝濡傛灉鍚庨潰瑕佷紭鍖栧墠闈㈣繖浜涗唬鐮� UpdataFunctionStatus(receiveObj.BodyDataString, null); } - else if (receiveObj.Topic == CommunicationTopic.ct.ControlSeurity +"_reply") + else if (receiveObj.Topic == CommunicationTopic.ct.ControlSeurity +"_reply" + || receiveObj.Topic == CommunicationTopic.ct.ReadSecurityStatus + "_reply" + || receiveObj.Topic == CommunicationTopic.ct.SecurityStatusUp) { - var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(receiveObj.BodyDataString); + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityStatusObj>(receiveObj.BodyDataString); if (temp != null) { Control_Udp.ReceiveRepeatManager(temp.id, null); + foreach (var updataSecurity in temp.objects) + { + var updataLocalSecurity = FunctionList.List.securities.Find((obj) => obj.sid == updataSecurity.sid); + if (updataLocalSecurity != null) + { + updataLocalSecurity.status = updataSecurity.status; + } + } + HomePage.LoadEvent_RefreshSecurityStatus(); + ArmCenterPage.LoadEvent_RefreshSecurityStatus(); } } else diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index ab7a620..1a46ca6 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -237,6 +237,14 @@ QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }; + //瀹夐槻鐘舵�佸彉鍖� + var securityStatusChange = new MqttTopicFilter() + { + Topic = $"/user/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/custom/security/status/up", + QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce + }; + + #endregion @@ -244,7 +252,8 @@ var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { pirStatus,pirStudy, appDeviceRefresh,appHomeRefresh,appRoomRefresh,residenceChange, - topicFilterPush2, topicAlinkStatus ,mqttkeyChange}); + topicFilterPush2, topicAlinkStatus ,mqttkeyChange, + securityStatusChange}); if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) { isSubscribeSuccess = true; @@ -434,7 +443,32 @@ pm.GetHomeGatewayList(); MainPage.Log($"缃戝叧瀵嗛挜鍙樻洿.鏂板瘑閽ワ細{DB_ResidenceData.Instance.HomeGateway.aesKey}"); } + //瀹夐槻鐘舵�佸彉鍖� + else if (topic == $"/user/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/custom/security/status/up") + { + MainPage.Log($"瀹夐槻鐘舵�佸彉鍖�"); + if (!string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.aesKey)) + { + var securityBytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.Instance.HomeGateway.aesKey); + var securityString = Encoding.UTF8.GetString(securityBytes); + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityStatusObj>(securityString); + if (temp != null) + { + Control_Udp.ReceiveRepeatManager(temp.id, null); + foreach (var updataSecurity in temp.objects) + { + var updataLocalSecurity = FunctionList.List.securities.Find((obj) => obj.sid == updataSecurity.sid); + if (updataLocalSecurity != null) + { + updataLocalSecurity.status = updataSecurity.status; + } + } + HomePage.LoadEvent_RefreshSecurityStatus(); + ArmCenterPage.LoadEvent_RefreshSecurityStatus(); + } + } + } #endregion //A缃戝叧璁惧鐘舵��-鍖呭惈娑傞甫璁惧 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send") diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index b78df5d..21fadf4 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -466,7 +466,7 @@ /// <summary> /// 缂栬緫瀹夐槻 /// </summary> - public const string Api_Post_Security_Edit = "/home-wisdom/app/security/update"; + public const string Api_Post_Security_Edit = "/home-wisdom/app/security/edit"; /// <summary> /// 鍒犻櫎瀹夐槻 /// </summary> diff --git a/HDL_ON/Entity/Function/SecurityAlarm.cs b/HDL_ON/Entity/Function/SecurityAlarm.cs index 4eda460..b226d7e 100644 --- a/HDL_ON/Entity/Function/SecurityAlarm.cs +++ b/HDL_ON/Entity/Function/SecurityAlarm.cs @@ -6,108 +6,17 @@ 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 { + public SecurityAlarm() + { + pushConfigs.Add(new SecurityPushConfig() + { + pushMethod = "APP", + pushTarget = new List<string>() { UserInfo.Current.ID } + }); + } + /// <summary> /// 瀹夐槻浜戠id /// </summary> @@ -125,7 +34,9 @@ /// </summary> public string delay; /// <summary> - /// 鐘舵�� enable甯冮槻銆乨isable鎾掗槻 + /// 鐘舵�� + /// 甯冮槻:enable + /// 鎾掗槻:disable /// </summary> public string status = "disable"; /// <summary> @@ -183,6 +94,8 @@ public string SaveInfo() { HttpServerRequest hsr = new HttpServerRequest(); + this.noticeConfig.enable = true; + this.noticeConfig.noticeContent = Language.StringByID(StringId.SecurityAlarmTipString).Replace("{0}", name); if (string.IsNullOrEmpty(sid)) { NewSid(); @@ -190,7 +103,8 @@ if (pack.Code == StateCode.SUCCESS) { SaveFile(); - }else + } + else { sid = ""; } @@ -246,9 +160,9 @@ int maxId = 1; - for (int i = 0; i < SecurityCenter.Security.securityAlarmList.Count; i++) + for (int i = 0; i < FunctionList.List.securities.Count; i++) { - string s = SecurityCenter.Security.securityAlarmList[i].sid.Substring(20, 4); + string s = FunctionList.List.securities[i].sid.Substring(20, 4); int iThisSceneId = Convert.ToInt16(s, 16); if (iThisSceneId > maxId) maxId = iThisSceneId; @@ -337,6 +251,11 @@ /// 瀹夐槻杈撳叆鏉′欢 /// </summary> public List<SecurityInputCondition> condition = new List<SecurityInputCondition>(); + + /// <summary> + /// 鍒ゆ柇鏉′欢 + /// </summary> + public string comparator = "="; /// <summary> /// 鍔犲叆杈撳叆鏉′欢 @@ -636,4 +555,23 @@ /// </summary> public List<string> pushTarget = new List<string>(); } + + + /// <summary> + /// A鍗忚鎺у埗鏁版嵁鐨勫璞� + /// </summary> + public class SecurityStatusObj + { + public List<SecurityStatusData> objects = new List<SecurityStatusData>(); + + public string time_stamp = ""; + public string id = ""; + } + + public class SecurityStatusData + { + public string sid; + public string status ="disable" ; + public string alarm ="false"; + } } diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 4a04b6f..d95e1ba 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -5,6 +5,7 @@ using HDL_ON.Common; using HDL_ON.DAL; using HDL_ON.DAL.Server; +using HDL_ON.DriverLayer; using Shared; namespace HDL_ON.Entity @@ -172,13 +173,7 @@ /// <summary> /// 瀹夐槻鍒楄〃 /// </summary> - public List<SecurityAlarm> securities - { - get - { - return SecurityCenter.Security.securityAlarmList; - } - } + public List<SecurityAlarm> securities = new List<SecurityAlarm>(); /// <summary> @@ -439,6 +434,17 @@ // break; //} } + if(DB_ResidenceData.Instance.GatewayType == 1) + { + Dictionary<string, string> pairs = new Dictionary<string, string>(); + string sendId = Control.Ins.msg_id.ToString(); + pairs.Add("id", sendId); + pairs.Add("time_stamp", Utlis.GetTimestamp()); + var readSecurityStatusJson = Newtonsoft.Json.JsonConvert.SerializeObject(pairs); + var sendBytes = Control.Ins.ConvertSendBodyData(CommunicationTopic.ct.ReadSecurityStatus, readSecurityStatusJson); + MainPage.Log($"鏈湴閫氳 璇诲彇瀹夐槻鐘舵��:{readSecurityStatusJson}"); + new Control_Udp().SendLocalHdlLinkData(sendBytes, sendId); + } } else { diff --git a/HDL_ON/UI/UI0-Public/TopViewDiv.cs b/HDL_ON/UI/UI0-Public/TopViewDiv.cs index 9ebf6a1..d7f18f7 100644 --- a/HDL_ON/UI/UI0-Public/TopViewDiv.cs +++ b/HDL_ON/UI/UI0-Public/TopViewDiv.cs @@ -376,7 +376,7 @@ Height = Application.GetMinRealAverage(28), UnSelectedImagePath = "FunctionIcon/ArmCenter/HistoryIcon.png", }; - contentView.AddChidren(btnAddIcon); + //contentView.AddChidren(btnAddIcon); btnAddIcon.MouseUpEventHandler += (sender, e) => { diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index dc250ad..9b24d88 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -387,7 +387,15 @@ if (DB_ResidenceData.Instance.GatewayType == 1) { topView.AddChidren(btnSecurityStatus); - btnSecurityStatus.IsSelected = SecurityCenter.Security.CurrentDefenseMode != null; + foreach (var temp in FunctionList.List.securities) + { + if (temp.status == "enable") + { + btnSecurityStatus.IsSelected = true; + break; + } + } + btnSecurityStatus.MouseUpEventHandler = (sender, e) => { var page = new ArmCenterPage(); MainPage.BasePageView.AddChidren(page); diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index 7cd1ce4..c88f248 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -34,7 +34,15 @@ { if (bodyView != null) { - bodyView.btnSecurityStatus.IsSelected = SecurityCenter.Security.CurrentDefenseMode != null; + foreach(var temp in FunctionList.List.securities) + { + if(temp.status == "enable") + { + bodyView.btnSecurityStatus.IsSelected = true; + return; + } + } + bodyView.btnSecurityStatus.IsSelected = false; } }); } diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 890573b..97b26bb 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -725,10 +725,10 @@ break; case ShowFunction.SecurityCenter: functionCount = FunctionList.List.securities.Count; - if (DB_ResidenceData.Instance.GatewayType == 1) - { - functionCount = 1; - } + //if (DB_ResidenceData.Instance.GatewayType == 1) + //{ + // functionCount = 1; + //} break; } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs index 1ffbbce..2c0a039 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs @@ -85,18 +85,18 @@ /// </summary> Button btnResidenceMemberText; #region F3闃舵 - ///// <summary> - ///// 鍖哄煙瀹夋斁灏忓尯鍩� - ///// </summary> - //FrameLayout residenceArmView; - ///// <summary> - ///// 鍖哄煙鎴愬畨鏀惧皬鍖哄煙鍥炬爣 - ///// </summary> - //Button btnResidenceArmIcon; - ///// <summary> - ///// 鍖哄煙瀹夋斁灏忓尯鍩熸枃鏈� - ///// </summary> - //Button btnResidenceArmText; + /// <summary> + /// 鍖哄煙瀹夋斁灏忓尯鍩� + /// </summary> + FrameLayout residenceArmView; + /// <summary> + /// 鍖哄煙鎴愬畨鏀惧皬鍖哄煙鍥炬爣 + /// </summary> + Button btnResidenceArmIcon; + /// <summary> + /// 鍖哄煙瀹夋斁灏忓尯鍩熸枃鏈� + /// </summary> + Button btnResidenceArmText; ///// <summary> ///// 鍖哄煙杈呭姪鍔熻兘灏忓尯鍩� ///// </summary> @@ -286,21 +286,21 @@ contentView.RemoveAll(); #region 浣忓畢淇℃伅鍖哄煙 - //if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) - //{ - // residenceInfoView = new FrameLayout() - // { - // Gravity = Gravity.CenterHorizontal, - // Width = Application.GetRealWidth(343), - // Height = Application.GetRealHeight(213), - // BackgroundColor = CSS_Color.MainBackgroundColor, - // Radius = (uint)Application.GetRealHeight(12), - // BorderColor = 0x00FFFFFF, - // BorderWidth = 0, - // }; - // contentView.AddChidren(residenceInfoView); - //} - //else + if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare && DB_ResidenceData.Instance.GatewayType == 1) + { + residenceInfoView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(213), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealHeight(12), + BorderColor = 0x00FFFFFF, + BorderWidth = 0, + }; + contentView.AddChidren(residenceInfoView); + } + else { residenceInfoView = new FrameLayout() { @@ -445,36 +445,41 @@ }; residenceMemberView.AddChidren(btnResidenceMemberText); #endregion - #region ---瀹夋斁鍖哄煙 + if (DB_ResidenceData.Instance.GatewayType == 1) + { + #region ---瀹夋斁鍖哄煙 + residenceArmView = new FrameLayout() + { + X = residenceMemberView.Right, + Y = Application.GetRealHeight(68), + Width = Application.GetRealWidth(64 + 48), + Height = Application.GetRealHeight(64), + }; + residenceInfoView.AddChidren(residenceArmView); + btnResidenceArmIcon = new Button + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(5), + Width = Application.GetMinRealAverage(30), + Height = Application.GetMinRealAverage(30), + UnSelectedImagePath = "PersonalCenter/ResidenceArmIcon.png", + SelectedImagePath = "PersonalCenter/ResidenceDefenseIcon.png", + }; + residenceArmView.AddChidren(btnResidenceArmIcon); + btnResidenceArmText = new Button() + { + Y = btnResidenceManageIcon.Bottom, + Height = Application.GetRealHeight(29), + TextID = StringId.Undefense, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel + }; + residenceArmView.AddChidren(btnResidenceArmText); + #endregion + } #region F3闃舵 - //residenceArmView = new FrameLayout() - //{ - // X = residenceMemberView.Right, - // Y = Application.GetRealHeight(68), - // Width = Application.GetRealWidth(64 + 48), - // Height = Application.GetRealHeight(64), - //}; - //residenceInfoView.AddChidren(residenceArmView); - //btnResidenceArmIcon = new Button - //{ - // Gravity = Gravity.CenterHorizontal, - // Y = Application.GetRealHeight(5), - // Width = Application.GetMinRealAverage(30), - // Height = Application.GetMinRealAverage(30), - // UnSelectedImagePath = "PersonalCenter/ResidenceArmIcon.png", - //}; - //residenceArmView.AddChidren(btnResidenceArmIcon); - //btnResidenceArmText = new Button() - //{ - // Y = btnResidenceManageIcon.Bottom, - // Height = Application.GetRealHeight(29), - // TextID = StringId.Undefense, - // TextAlignment = TextAlignment.Center, - // TextColor = CSS_Color.FirstLevelTitleColor, - // TextSize = CSS_FontSize.PromptFontSize_FirstLevel - //}; - //residenceArmView.AddChidren(btnResidenceArmText); - #endregion + #region ---鏁版嵁澶囦唤鍖哄煙 //residenceDataBackupView = new FrameLayout() //{ @@ -539,9 +544,9 @@ #region ---娣诲姞鍔熻兘鍖哄煙 residenceAddFunctionView = new FrameLayout() { - X = residenceMemberView.Right, - //X = Application.GetRealWidth(28 - 24), - Y = Application.GetRealHeight(68), + //X = residenceMemberView.Right, + X = Application.GetRealWidth(28 - 24), + Y = residenceManageView.Bottom, Width = Application.GetRealWidth(64 + 48), Height = Application.GetRealWidth(64), }; @@ -580,36 +585,40 @@ TextID = StringId.FunctionNotOpen, }); + if (DB_ResidenceData.Instance.GatewayType == 1) + { + #region ---瀹夋斁鍖哄煙 + residenceArmView = new FrameLayout() + { + X = Application.GetRealWidth(28 - 24), + Y = Application.GetRealHeight(68), + Width = Application.GetRealWidth(64 + 48), + Height = Application.GetRealWidth(64), + }; + residenceInfoView.AddChidren(residenceArmView); + btnResidenceArmIcon = new Button + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(5), + Width = Application.GetMinRealAverage(30), + Height = Application.GetMinRealAverage(30), + UnSelectedImagePath = "PersonalCenter/ResidenceArmIcon.png", + SelectedImagePath = "PersonalCenter/ResidenceDefenseIcon.png", + }; + residenceArmView.AddChidren(btnResidenceArmIcon); + btnResidenceArmText = new Button() + { + Y = btnResidenceArmIcon.Bottom, + Height = Application.GetRealHeight(29), + TextID = StringId.Undefense, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel + }; + residenceArmView.AddChidren(btnResidenceArmText); + #endregion + } #region F3闃舵 - #region ---瀹夋斁鍖哄煙 - //residenceArmView = new FrameLayout() - //{ - // X = Application.GetRealWidth(28 - 24), - // Y = Application.GetRealHeight(68), - // Width = Application.GetRealWidth(64 + 48), - // Height = Application.GetRealWidth(64), - //}; - //residenceInfoView.AddChidren(residenceArmView); - //btnResidenceArmIcon = new Button - //{ - // Gravity = Gravity.CenterHorizontal, - // Y = Application.GetRealHeight(5), - // Width = Application.GetMinRealAverage(30), - // Height = Application.GetMinRealAverage(30), - // UnSelectedImagePath = "PersonalCenter/ResidenceArmIcon.png", - //}; - //residenceArmView.AddChidren(btnResidenceArmIcon); - //btnResidenceArmText = new Button() - //{ - // Y = btnResidenceArmIcon.Bottom, - // Height = Application.GetRealHeight(29), - // TextID = StringId.Undefense, - // TextAlignment = TextAlignment.Center, - // TextColor = CSS_Color.FirstLevelTitleColor, - // TextSize = CSS_FontSize.PromptFontSize_FirstLevel - //}; - //residenceArmView.AddChidren(btnResidenceArmText); - #endregion #region ---鏁版嵁澶囦唤鍖哄煙 //residenceDataBackupView = new FrameLayout() //{ diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index ff66821..dad9f45 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -26,6 +26,55 @@ LoadEvent_SkipbtnAddFunctionPage(); LoadEvent_SkipSmartSpeakerPage(); } + if(DB_ResidenceData.Instance.GatewayType == 1) + { + LoadEvent_SecurityEvent(); + } + } + + /// <summary> + /// 瀹夐槻閮ㄥ垎浜嬩欢 + /// </summary> + void LoadEvent_SecurityEvent() + { + if (btnResidenceArmIcon != null) + { + btnResidenceArmIcon.IsSelected = false; + foreach (var temp in FunctionList.List.securities) + { + if (temp.status == "enable") + { + btnResidenceArmIcon.IsSelected = true; + break; + } + } + btnResidenceArmIcon.MouseUpEventHandler = (sender, e) => + { + var page = new ArmCenterPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + if (btnResidenceArmText != null) + { + btnResidenceArmText.TextID = StringId.Undefense; + foreach (var temp in FunctionList.List.securities) + { + if (temp.status == "enable") + { + btnResidenceArmText.TextID = StringId.Defense; + break; + } + } + btnResidenceArmText.MouseUpEventHandler = (sender, e) => + { + var page = new ArmCenterPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } } #region 鍒囨崲浣忓畢 diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs index d47f84d..8d15c4e 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs @@ -153,8 +153,11 @@ //甯冮槻鍔熻兘 iniDefenseView(); + +#if DEBUG //鍛婅鐩爣 iniAlarmView(); +#endif #region 搴曢儴鍖哄煙 var bottomView = new FrameLayout() @@ -183,6 +186,18 @@ btnConfrim.MouseUpEventHandler = (sender, e) => { + if (string.IsNullOrEmpty( securityAlarm.name )) + { + var tip = new Tip() + { + Text = "璇疯緭鍏ュ畨闃插悕绉�", + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(MainPage.BaseView); + return; + } + if (securityAlarm.input.Count == 0) { var tip = new Tip() @@ -194,18 +209,17 @@ 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; - } + //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(); @@ -216,7 +230,7 @@ var code = securityAlarm.SaveInfo(); if (code == StateCode.SUCCESS) { - SecurityCenter.Security.GetSecurityAlarmList(); + Common.ApiUtlis.Ins.GetSecurityList(); Application.RunOnMainThread(() => { this.RemoveFromParent(); @@ -317,7 +331,10 @@ { foreach (var target in securityAlarm.input) { - inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName(),target.StateText())); + if (target.GetFunction() != null) + { + inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName(), target.StateText())); + } } inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count); //if (outputTargetView != null) @@ -469,25 +486,7 @@ 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> @@ -533,7 +532,7 @@ Button btnState = new Button() { - Width = Application.GetRealWidth(369), + Width = Application.GetRealWidth(360), TextAlignment = TextAlignment.CenterRight, TextSize = CSS_FontSize.TextFontSize, TextColor = CSS_Color.FirstLevelTitleColor, diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs index 9d0a8c2..ded7468 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs @@ -150,6 +150,11 @@ //鍒濆鍊� functions = FunctionList.List.GetArmSensorList(); } + +#if DEBUG + functions.AddRange(FunctionList.List.GetLightList()); +#endif + foreach (var function in functions) { var input = securityAlarm.input.Find((obj) => obj.sid == function.sid); @@ -157,6 +162,28 @@ { input = new SecurityInput(); input.sid = function.sid; + + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = "status", + value = "true", + } + }; + + if (function.spk == SPK.LightSwitch || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) + { + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = FunctionAttributeKey.OnOff, + value = "off", + } + }; + } + } else { @@ -222,10 +249,10 @@ if(btnChooseIcon.IsSelected) { input.addCondition = true; - if (input.condition.Count==0) - { - ShowStateDialog(input, btnState,btnChooseIcon); - } + //if (input.condition.Count==0) + //{ + // ShowStateDialog(input, btnState,btnChooseIcon,function.spk); + //} } else { @@ -234,7 +261,16 @@ }; btnState.MouseUpEventHandler = (sender, e) => { - ShowStateDialog(input, btnState, btnChooseIcon); + //ShowStateDialog(input, btnState, btnChooseIcon, function.spk); + btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected; + if (btnChooseIcon.IsSelected) + { + input.addCondition = true; + } + else + { + input.addCondition = false; + } }; @@ -258,7 +294,7 @@ } - private void ShowStateDialog(SecurityInput input,Button btnState,Button btnChoose = null) + private void ShowStateDialog(SecurityInput input,Button btnState,Button btnChoose ,string spk) { Dialog dialog = new Dialog(); @@ -340,6 +376,21 @@ value = "true", } }; + + if (spk == SPK.LightSwitch || spk == SPK.LightRGB || spk == SPK.LightDimming) + { + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = FunctionAttributeKey.OnOff, + value = "on", + } + }; + } + + + input.addCondition = true; if (btnChoose != null) { @@ -359,6 +410,20 @@ value = "false", } }; + + if (spk == SPK.LightSwitch || spk == SPK.LightRGB || spk == SPK.LightDimming) + { + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = FunctionAttributeKey.OnOff, + value = "off", + } + }; + } + + input.addCondition = true; if (btnChoose != null) { diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs index a883705..0e7b6ff 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs @@ -10,11 +10,23 @@ /// <summary> /// 涓荤獥浣� /// </summary> - FrameLayout bodyView; + public static ArmCenterPage bodyView; /// <summary> /// 鑷畾涔夊竷闃插尯鍩� /// </summary> HorizontalScrolViewLayout customDeploymentView; + + //瀹夐槻鐘舵�佽儗鏅浘 + Button btnArmTipIcon; + /// <summary> + /// 褰撳墠甯冮槻鍚嶇О + /// </summary> + Button btnDefenseName; + + /// <summary> + /// 鎾ら槻鍖哄煙 + /// </summary> + FrameLayout disarmView; public ArmCenterPage() { @@ -43,16 +55,33 @@ Height =Application.GetRealWidth(32), }); - //瀹夐槻鐘舵�佽儗鏅浘 - Button btnArmTipIcon = new Button() + FrameLayout alarmIconBgView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(198), Height = Application.GetRealWidth(198), + }; + contentView.AddChidren(alarmIconBgView); + + btnArmTipIcon = new Button() + { + //Gravity = Gravity.CenterHorizontal, + //Width = Application.GetRealWidth(198), + //Height = Application.GetRealWidth(198), UnSelectedImagePath = "FunctionIcon/ArmCenter/NoDefenseBigIcon.png", SelectedImagePath = "FunctionIcon/ArmCenter/InDefenseBigIcon.png", }; - contentView.AddChidren(btnArmTipIcon); + alarmIconBgView.AddChidren(btnArmTipIcon); + + btnDefenseName = new Button() + { + Y = Application.GetRealWidth(117), + Height = Application.GetRealHeight(81), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextColor = CSS_Color.MainBackgroundColor, + }; + alarmIconBgView.AddChidren(btnDefenseName); contentView.AddChidren(new Button() { @@ -61,34 +90,42 @@ #region 鎾ら槻鍖哄煙 - var disarmView = new FrameLayout() + Button btnDisarm; + disarmView = new FrameLayout() { Height = 0, }; contentView.AddChidren(disarmView); - var btnDisarm = new Button() + btnDisarm = new Button() { - Width = Application.GetRealWidth(120), - Height = Application.GetRealHeight(44), - BackgroundColor = CSS_Color.WarningColor, + Y = Application.GetRealHeight(10), + Width = Application.GetRealWidth(148), + Height = Application.GetRealHeight(40), + BackgroundColor = CSS_Color.MainColor, TextAlignment = TextAlignment.Center, TextColor = CSS_Color.MainBackgroundColor, - Text = "鎾ら槻" + Text = "鎾ら槻", + Radius = (uint)Application.GetRealWidth(20), + Gravity = Gravity.CenterHorizontal, }; disarmView.AddChidren(btnDisarm); btnDisarm.MouseUpEventHandler = (sender, e) => { - if (SecurityCenter.Security.CurrentDefenseMode != null) + foreach (var temp in FunctionList.List.securities) { - Control.Ins.ControlSecurity(SecurityCenter.Security.CurrentDefenseMode, "disable"); + if (temp.status == "enable") + { + Control.Ins.ControlSecurity(temp, "disable"); + break; + } } }; - #endregion + #endregion - #region 鑷畾涔夊竷闃� - //鑷畾涔夊竷闃叉爣棰� - Button btnCustomDeploymentTitle = new Button() + #region 鑷畾涔夊竷闃� + //鑷畾涔夊竷闃叉爣棰� + Button btnCustomDeploymentTitle = new Button() { X = Application.GetRealWidth(24), Height = Application.GetRealWidth(54), @@ -107,8 +144,6 @@ ScrollEnabled = false, }; contentView.AddChidren(customDeploymentView); - - iniCustomDeploymentView(); #endregion @@ -184,8 +219,8 @@ - - + ///鍒锋柊鐣岄潰 + LoadEvent_RefreshSecurityStatus(); } @@ -198,14 +233,18 @@ foreach (var mode in FunctionList.List.securities) { - var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png", + var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png", mode.name); customDeploymentView.AddChidren(armDiyView); EventHandler<MouseEventArgs> event2 = (sender, e) => - { - ShowArmDialog(mode); - }; + { + ShowArmDialog(mode); + }; armDiyView.SetClickEvent(event2); + if (mode.status == "enable") + { + armDiyView.LightingView(true); + } } if (FunctionList.List.securities.Count < 4) @@ -293,8 +332,20 @@ dialog.Show(); + if(alarm.status == "enable") + { + btnOpen.TextColor = CSS_Color.PromptingColor1; + btnOpen.Text = Language.StringByID(StringId.AlreadyOpened).Trim() ; + } + btnOpen.MouseUpEventHandler = (sender, e) => { - Control.Ins.ControlSecurity(alarm, "enable"); + if (alarm.status == "disable") + { + Control.Ins.ControlSecurity(alarm, "enable"); + }else + { + Control.Ins.ControlSecurity(alarm, "disable"); + } dialog.Close(); }; @@ -305,7 +356,7 @@ { iniCustomDeploymentView(); }; - var armSetPage = new ArmDeploymentSettingPage(alarm,refreshAction); + var armSetPage = new AddAlarmDeploymentPage(alarm,refreshAction); MainPage.BasePageView.AddChidren(armSetPage); armSetPage.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -318,7 +369,29 @@ } - + public static void LoadEvent_RefreshSecurityStatus() + { + Application.RunOnMainThread(() => + { + if (bodyView != null) + { + bodyView.iniCustomDeploymentView(); + bodyView.disarmView.Height = 0; + bodyView.btnArmTipIcon.IsSelected = false; + bodyView.btnDefenseName.Text = ""; + foreach (var temp in FunctionList.List.securities) + { + if (temp.status == "enable") + { + bodyView.disarmView.Height = Application.GetRealHeight(68); + bodyView.btnArmTipIcon.IsSelected = true; + bodyView.btnDefenseName.Text = temp.name; + break; + } + } + } + }); + } } @@ -369,6 +442,14 @@ btnText.MouseUpEventHandler = eventHandler; } + /// <summary> + /// 鐐逛寒鍖哄煙 + /// </summary> + public void LightingView(bool seleted) + { + btnIcon.IsSelected = seleted; + } + } diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs index 5de018c..4cf7387 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs @@ -216,7 +216,7 @@ var code = securityAlarm.SaveInfo(); if (code == StateCode.SUCCESS) { - SecurityCenter.Security.GetSecurityAlarmList(); + Common.ApiUtlis.Ins.GetSecurityList(); Application.RunOnMainThread(() => { this.RemoveFromParent(); -- Gitblit v1.8.0