From db1b76418c083e74fe16a65cddddf578de3d09cc Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 19 四月 2021 09:29:10 +0800 Subject: [PATCH] 安防界面 --- HDL-ON_Android/Assets/Language.ini | 11 HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AtHomeDefenseIcon.png | 0 HDL-ON_iOS/HDL-ON_iOS.csproj | 12 HDL_ON/Common/ApiUtlis.cs | 51 +- HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs | 128 ++++++ HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/NoDefenseBigIcon.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HouseDefenseIcon.png | 0 HDL_ON/HDL_ON.projitems | 4 HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/DisasterAlarmIcon.png | 0 HDL-ON_iOS/Resources/Language.ini | 6 HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HolidayDefenseIconOn.png | 0 .vs/HDL_APP_Project/xs/UserPrefs.xml | 49 +- HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/InDefenseBigIcon.png | 0 HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs | 377 +++++++++++++++--- HDL_ON/Entity/Function/Security.cs | 234 +++++++++++ HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/BurglarAlarmIcon.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png | 0 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 4 HDL_ON/Entity/FunctionList.cs | 35 + HDL_ON/UI/UI0-Public/TopViewDiv.cs | 27 + HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HouseDefenseIconOn.png | 0 HDL_ON/DAL/Server/NewAPI.cs | 47 ++ HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AddDefenseIcon.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HolidayDefenseIcon.png | 0 HDL_ON/Common/R.cs | 1 HDL_ON/DAL/Server/HttpServerRequest.cs | 168 ++++++++ HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HistoryIcon.png | 0 27 files changed, 1,018 insertions(+), 136 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index f7957ac..5c3a958 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,22 +1,15 @@ 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.26569F89-0BA9-4C06-81F2-764A3AF2E1B7" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/DriverLayer/Control_Udp.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs" Line="36" Column="20" /> - <File FileName="HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs" /> - <File FileName="HDL-ON_Android/Application.cs" /> - <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" /> - <File FileName="HDL_ON/UI/MainPage.cs" /> - <File FileName="HDL_ON/Common/R.cs" /> - <File FileName="HDL-ON_Android/Assets/Language.ini" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs" Line="300" Column="56" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneCatchFunctionListPage.cs" Line="104" Column="56" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="634" Column="40" /> - <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="300" Column="1" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" Line="147" Column="36" /> - <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="159" Column="1" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs" Line="66" Column="1" /> + <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="367" Column="38" /> + <File FileName="HDL_ON/Entity/FunctionList.cs" Line="143" Column="31" /> + <File FileName="HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs" Line="565" Column="50" /> + <File FileName="HDL_ON/Entity/Enumerative/MyEnum.cs" Line="171" Column="9" /> + <File FileName="HDL_ON/Entity/Room.cs" Line="58" Column="23" /> + <File FileName="HDL_ON/UI/BindingResidence/BindingResidencePage.cs" Line="1" Column="1" /> + <File FileName="HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs" Line="1" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> @@ -25,32 +18,31 @@ <Node name="HDL_ON" expanded="True"> <Node name="Common" expanded="True" /> <Node name="DAL" expanded="True"> - <Node name="DriverLayer" expanded="True"> - <Node name="Control_Udp.cs" selected="True" /> - </Node> + <Node name="Server" expanded="True" /> </Node> <Node name="Entity" expanded="True"> + <Node name="Enumerative" expanded="True" /> <Node name="Function" expanded="True" /> </Node> <Node name="UI" expanded="True"> - <Node name="UI0-Public" expanded="True" /> + <Node name="BindingResidence" 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="Scene" expanded="True" /> + <Node name="1-HomePage" expanded="True"> + <Node name="MessageCenterPage.cs" selected="True" /> </Node> - <Node name="4-PersonalCenter" expanded="True"> - <Node name="MemberManagement" expanded="True" /> + <Node name="FuntionControlView" expanded="True"> + <Node name="ArmCenter" expanded="True" /> </Node> - <Node name="FuntionControlView" expanded="True" /> </Node> </Node> </Node> <Node name="HDL-ON_Android" expanded="True"> <Node name="Assets" expanded="True" /> </Node> - <Node name="HDL-ON_iOS" expanded="True" /> + <Node name="HDL-ON_iOS" expanded="True"> + <Node name="Other" expanded="True" /> + <Node name="Resources" expanded="True" /> + </Node> </Node> </State> </Pad> @@ -68,7 +60,6 @@ <BreakpointStore> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" line="34" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs" line="313" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneCatchFunctionListPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneCatchFunctionListPage.cs" line="210" column="1" /> </BreakpointStore> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index e5c9d89..4be6895 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -328,7 +328,7 @@ 324=Scene delay 325=Delay setting 326=Delay -327=Catch Scene +327=Capture the scene 328=Film scene 329=General 330=Automatic mode @@ -426,8 +426,7 @@ 439=Real time power consumption: {0} kw 440=Next step 441=Please select all areas of capture status -442=Generate scene - +442=Custom deployment 1000=Room Humidity 1001=V-chip @@ -1107,7 +1106,7 @@ 324=鍦烘櫙寤舵椂 325=寤舵椂璁剧疆 326=寤舵椂 -327=鎹曡幏鍦烘櫙 +327=鎹曟崏鍦烘櫙 328=鐢靛奖鍦烘櫙 329=鏅�� 330=鑷姩妯″紡 @@ -1204,8 +1203,8 @@ 438=婀垮害:{0}% 绌烘皵:{1} 椋庨��:{2}绾� 439=瀹炴椂鍔熻��: {0}kW 440=涓嬩竴姝� -441=璇烽�夋嫨鎹曡幏鐘舵�佺殑鍖哄煙 -442=鐢熸垚鍦烘櫙 +441=璇烽�夋嫨鎹曟崏鐘舵�佺殑鍖哄煙 +442=鑷畾涔夊竷闃� 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index e767896..b18bd6a 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1219,6 +1219,18 @@ <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_blue.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_white.png" /> <BundleResource Include="Resources\Phone\Public\RightSlideBackIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\DisasterAlarmIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\InDefenseBigIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\AddDefenseIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\HouseDefenseIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\HolidayDefenseIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\AtHomeDefenseIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\AtHomeDefenseIconOn.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\NoDefenseBigIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\HolidayDefenseIconOn.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\HouseDefenseIconOn.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\BurglarAlarmIcon.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\HistoryIcon.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 3923d05..4be6895 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -426,6 +426,7 @@ 439=Real time power consumption: {0} kw 440=Next step 441=Please select all areas of capture status +442=Custom deployment 1000=Room Humidity 1001=V-chip @@ -1105,7 +1106,7 @@ 324=鍦烘櫙寤舵椂 325=寤舵椂璁剧疆 326=寤舵椂 -327=鎹曡幏鍦烘櫙 +327=鎹曟崏鍦烘櫙 328=鐢靛奖鍦烘櫙 329=鏅�� 330=鑷姩妯″紡 @@ -1202,7 +1203,8 @@ 438=婀垮害:{0}% 绌烘皵:{1} 椋庨��:{2}绾� 439=瀹炴椂鍔熻��: {0}kW 440=涓嬩竴姝� -441=璇烽�夋嫨鎹曡幏鐘舵�佺殑鍖哄煙 +441=璇烽�夋嫨鎹曟崏鐘舵�佺殑鍖哄煙 +442=鑷畾涔夊竷闃� 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AddDefenseIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AddDefenseIcon.png new file mode 100644 index 0000000..0eceeb6 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AddDefenseIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AtHomeDefenseIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AtHomeDefenseIcon.png new file mode 100644 index 0000000..a662e7c --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AtHomeDefenseIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png new file mode 100644 index 0000000..ff57647 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/BurglarAlarmIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/BurglarAlarmIcon.png new file mode 100644 index 0000000..082eecf --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/BurglarAlarmIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/DisasterAlarmIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/DisasterAlarmIcon.png new file mode 100644 index 0000000..b213453 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/DisasterAlarmIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HistoryIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HistoryIcon.png new file mode 100644 index 0000000..3e3be55 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HistoryIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HolidayDefenseIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HolidayDefenseIcon.png new file mode 100644 index 0000000..0e0d1f1 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HolidayDefenseIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HolidayDefenseIconOn.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HolidayDefenseIconOn.png new file mode 100644 index 0000000..b532639 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HolidayDefenseIconOn.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HouseDefenseIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HouseDefenseIcon.png new file mode 100644 index 0000000..e41b150 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HouseDefenseIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HouseDefenseIconOn.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HouseDefenseIconOn.png new file mode 100644 index 0000000..a434791 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/HouseDefenseIconOn.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/InDefenseBigIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/InDefenseBigIcon.png new file mode 100644 index 0000000..7f4bbd7 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/InDefenseBigIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/NoDefenseBigIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/NoDefenseBigIcon.png new file mode 100644 index 0000000..0555432 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/ArmCenter/NoDefenseBigIcon.png Binary files differ diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 2013562..95d8510 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -106,26 +106,6 @@ } endTime = DateTime.Now.AddSeconds(5); MainPage.Log($"鍒锋柊涓汉淇℃伅鎴愬姛"); - - //int count = 0; - //while (count < 10) - //{ - // if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull()) - // { - // System.Threading.Thread.Sleep(200); - // } - // else - // { - // break; - // } - // count++; - //} - //if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull()) - //{ - // return; - //} - - try { //===================鎴块棿======================= @@ -275,6 +255,8 @@ MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁澶辫触:Code:{pack.Code}; Msg:{pack.message}"); } + //===================璇诲彇瀹夐槻鍒楄〃========================== + GetSecurityList(); //===================璇诲彇閫昏緫鍒楄〃========================== UI.UI2.Intelligence.Automation.MainView.GetLogicList(); //===================璇诲彇鍙瀵硅鏁版嵁========================== @@ -371,5 +353,34 @@ } } } + + /// <summary> + /// 鑾峰彇瀹夐槻鍒楄〃 + /// </summary> + public void GetSecurityList() + { + var pack = Ins.HttpRequest.GetSecurityList(); + if (pack.Code == StateCode.SUCCESS) + { + var packList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Security>>(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<Security>>(infoListPack.Data.ToString()); + foreach (var function in infoList) + { + function.SaveFile(); + FunctionList.List.IniFunctionList(function.savePath, true); + } + } + else + { + MainPage.Log($"璇诲彇瀹夐槻鍒楄〃澶辫触:Code:{pack.Code}; Msg:{pack.message}"); + } + + } } } \ No newline at end of file diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index a06d9be..a04ca38 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -4,6 +4,7 @@ { public static class StringId { + public const int CustomDeployment = 443; public const int GenerateScene = 442; public const int ChooseCatchZone = 441; public const int NextStep = 440; diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 0ba5b75..e7d32ab 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -2192,7 +2192,173 @@ #endregion - #region Kaede --鎴块棿鍔熻兘-------------------------- + #region Kaede -- 瀹夐槻鎺ュ彛____________________________ + /// <summary> + /// 鑾峰彇瀹夐槻鍒楄〃 + /// </summary> + public ResponsePackNew GetSecurityList() + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_List, requestJson); + return pack; + } + /// <summary> + /// 鑾峰彇瀹夐槻璇︽儏 + /// </summary> + /// <param name="sidList">瀹夐槻sid闆嗗悎</param> + /// <param name="userSecurityIds">瀹夐槻浜戠id</param> + /// <returns></returns> + public ResponsePackNew GetSecurityInfo(List<string> sidList, List<string> userSecurityIds) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); + //sids userSecurityIds 涓嶈兘鍚屾椂涓虹┖ + d.Add("sids", sidList); + d.Add("userSecurityIds", userSecurityIds); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_Info, requestJson); + return pack; + } + /// <summary> + /// 娣诲姞瀹夐槻 + /// </summary> + public ResponsePackNew AddSecurity(List<Security> securities) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); + d.Add("securitys", securities); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_Add, requestJson); + return pack; + } + /// <summary> + /// 缂栬緫瀹夐槻 + /// </summary> + public ResponsePackNew EditSecurity(List<Security> securities) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); + d.Add("securitys", securities); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_Edit, requestJson); + return pack; + } + /// <summary> + /// 鍒犻櫎瀹夐槻 + /// </summary> + /// <param name="sidList">瀹夐槻sid</param> + /// <param name="userSecurityIds">瀹夐槻浜戠id</param> + /// <returns></returns> + public ResponsePackNew DeleteSecurity(List<string> sidList, List<string> userSecurityIds) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); + //sids userSecurityIds 涓嶈兘鍚屾椂涓虹┖ + d.Add("sids", sidList); + d.Add("userSecurityIds", userSecurityIds); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_Delete, requestJson); + return pack; + } + /// <summary> + /// 璇诲彇瀹夐槻闃插尯鐘舵�� + /// </summary> + /// <param name="sidList">瀹夐槻sid</param> + /// <param name="userSecurityIds">瀹夐槻浜戠id</param> + /// <returns></returns> + public ResponsePackNew ReadSecurityStatus(List<string> sidList, List<string> userSecurityIds) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); + //sids userSecurityIds 涓嶈兘鍚屾椂涓虹┖ + d.Add("sids", sidList); + d.Add("userSecurityIds", userSecurityIds); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_StatusRead, requestJson); + return pack; + } + /// <summary> + /// 璁剧疆瀹夐槻闃插尯鐘舵�� + /// </summary> + public ResponsePackNew SetSecurityStatus(List<SecurityState> securityStates) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("securitys", securityStates); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_StatusSet, requestJson); + return pack; + } + + /// <summary> + /// 瀹夐槻bypass璁剧疆 + /// </summary> + public ResponsePackNew SetSecurityBypass(List<SecurityBypass> securityBypassStates) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("securitys", securityBypassStates); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_BypassSet, requestJson); + return pack; + } + /// <summary> + /// 瀹夐槻bypass璇诲彇 + /// </summary> + /// <param name="sidList">瀹夐槻sid</param> + /// <param name="userSecurityIds">瀹夐槻浜戠id</param> + /// <returns></returns> + public ResponsePackNew ReadSecurityBypass(List<string> sidList, List<string> userSecurityIds) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); + //sids userSecurityIds 涓嶈兘鍚屾椂涓虹┖ + d.Add("sids", sidList); + d.Add("userSecurityIds", userSecurityIds); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_BypassRead, requestJson); + return pack; + } + /// <summary> + /// 鏌ヨ瀹夐槻鎵�鏈夎褰� + /// </summary> + public ResponsePackNew GetSecurityLogList(string pageSize,string pageNo) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("pageSize", pageSize); + d.Add("pageNo", pageNo); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_ListSecurityLog, requestJson); + return pack; + } + /// <summary> + /// 鏌ヨ瀹夐槻鎶ヨ璁板綍 + /// </summary> + public ResponsePackNew GetSecurityAlarmLogList(string pageSize, string pageNo) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("pageSize", pageSize); + d.Add("pageNo", pageNo); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_ListAlarmLog, requestJson); + return pack; + } + + #endregion + + + #region Kaede --绗笁鏂瑰搧鐗屽姛鑳�-------------------------- /// <summary> /// 鑾峰彇绗笁鏂瑰搧鐗屽垪琛� /// </summary> diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index dfb9735..569ee79 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -427,6 +427,53 @@ #endregion + #region Kaede -- 瀹夐槻鎺ュ彛____________________________ + /// <summary> + /// 鑾峰彇瀹夐槻鍒楄〃 + /// </summary> + public const string Api_Post_Security_List = "/home-wisdom/app/security/list"; + /// <summary> + /// 鑾峰彇瀹夐槻璇︽儏 + /// </summary> + public const string Api_Post_Security_Info = "/home-wisdom/app/security/info"; + /// <summary> + /// 娣诲姞瀹夐槻 + /// </summary> + public const string Api_Post_Security_Add = "/home-wisdom/app/security/add"; + /// <summary> + /// 缂栬緫瀹夐槻 + /// </summary> + public const string Api_Post_Security_Edit = "/home-wisdom/app/security/update"; + /// <summary> + /// 鍒犻櫎瀹夐槻 + /// </summary> + public const string Api_Post_Security_Delete = "/home-wisdom/app/security/delete"; + /// <summary> + /// 璇诲彇瀹夐槻闃插尯鐘舵�� + /// </summary> + public const string Api_Post_Security_StatusRead = "/home-wisdom/app/security/statusRead"; + /// <summary> + /// 璁剧疆瀹夐槻闃插尯鐘舵�� + /// </summary> + public const string Api_Post_Security_StatusSet = "/home-wisdom/app/security/statusSet"; + /// <summary> + /// 瀹夐槻bypass璁剧疆 + /// </summary> + public const string Api_Post_Security_BypassSet = "/home-wisdom/app/security/bypassSet"; + /// <summary> + /// 瀹夐槻bypass璇诲彇 + /// </summary> + public const string Api_Post_Security_BypassRead = "/home-wisdom/app/security/bypassRead"; + /// <summary> + /// 鏌ヨ瀹夐槻鎵�鏈夎褰� + /// </summary> + public const string Api_Post_Security_ListSecurityLog = "/home-wisdom/app/security/listSecurityLog"; + /// <summary> + /// 鏌ヨ瀹夐槻鎶ヨ璁板綍 + /// </summary> + public const string Api_Post_Security_ListAlarmLog = "/home-wisdom/app/security/listAlarmLog"; + + #endregion #region 鈻� -- 鎴块棿銆佽澶囥�佸満鏅垎浜玙__________________________ diff --git a/HDL_ON/Entity/Function/Security.cs b/HDL_ON/Entity/Function/Security.cs new file mode 100644 index 0000000..332764e --- /dev/null +++ b/HDL_ON/Entity/Function/Security.cs @@ -0,0 +1,234 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.Common; + +namespace HDL_ON.Entity +{ + public class Security + { + /// <summary> + /// 瀹夐槻sid + /// </summary> + public string sid; + /// <summary> + /// 瀹夐槻鍚嶇О + /// </summary> + public string name; + /// <summary> + /// 瀹夐槻寤舵椂 + /// </summary> + public string delay; + /// <summary> + /// 鐘舵�� enable甯冮槻銆乨isable鎾掗槻 + /// </summary> + public string status; + /// <summary> + /// 绫诲瀷 + /// "all"--鍏ㄥ畢甯冮槻锛� + /// "normal"--鏅�氭ā寮�, + /// "all_day":24灏忔椂, + /// "mute"锛氶潤闊� + /// </summary> + public string type; + /// <summary> + /// 鏇存柊鏃堕棿 + /// </summary> + public string modifyTime; + /// <summary> + /// 瀹夐槻杈撳叆鏉′欢 + /// </summary> + public List<SecurityInput> input = new List<SecurityInput>(); + /// <summary> + /// 瀹夐槻杈撳嚭 + /// </summary> + public List<SecurityOutput> output = new List<SecurityOutput>(); + /// <summary> + /// 瀹夐槻閫氱煡閰嶇疆 + /// </summary> + public SecurityNoticeConfig noticeConfig = new SecurityNoticeConfig(); + /// <summary> + /// 瀹夐槻鎺ㄩ�侀厤缃� + /// </summary> + public List<SecurityPushConfig> pushConfigs = new List<SecurityPushConfig>(); + + /// <summary> + /// 鏁版嵁瀛樺偍鏂囦欢鍚� + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public string savePath + { + get + { + return "SecurityData_" + sid; + } + } + /// <summary> + /// 淇濆瓨鏂囦欢 + /// </summary> + public void SaveFile() + { + var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); + FileUtlis.Files.WriteFileByBytes(savePath, ssd); + } + } + + /// <summary> + /// 瀹夐槻鐘舵�侀厤缃� + /// </summary> + public class SecurityState + { + /// <summary> + /// 瀹夐槻浜戠id + /// </summary> + public string userSecurityId; + /// <summary> + /// 缃戝叧id 缃戝叧id 濡傛灉浼犵殑鏄痵id璇ュ瓧娈甸渶瑕佷紶 + /// </summary> + public string gatewayId; + /// <summary> + /// 瀹夐槻sid + /// </summary> + public string sid; + /// <summary> + /// 鐘舵�� enable甯冮槻銆乨isable鎾掗槻 + /// </summary> + public string status; + } + + /// <summary> + /// 瀹夐槻bypass璁剧疆瀵硅薄 + /// </summary> + public class SecurityBypass + { + /// <summary> + /// 瀹夐槻浜戠id + /// </summary> + public string userSecurityId; + /// <summary> + /// 杈撳叆璁惧bypass鐘舵�佸垪琛� + /// </summary> + public List<SecurityBypassInput> input = new List<SecurityBypassInput>(); + + } + /// <summary> + /// 杈撳叆璁惧bypass鐘舵�� + /// </summary> + public class SecurityBypassInput + { + /// <summary> + /// 璁惧sid + /// </summary> + public string sid; + /// <summary> + /// true:鍚敤 + /// false:鍋滅敤锛堜复鏃禸ypass锛� + /// </summary> + public string bypass; + } + + + /// <summary> + /// 瀹夐槻杈撳叆 + /// </summary> +public class SecurityInput + { + /// <summary> + /// 杈撳叆鏉′欢锛堝姛鑳斤級鐨剆id + /// 杈撳叆璁惧sid + /// </summary> + public string sid; + /// <summary> + /// Bypass璁剧疆 true:鍚敤涓�乫alse:涓存椂bypass涓� + /// </summary> + public string bypass; + /// <summary> + /// 瀹夐槻杈撳叆鏉′欢 + /// </summary> + public List<SecurityInputCondition> condition = new List<SecurityInputCondition>(); + + } + /// <summary> + /// 瀹夐槻杈撳叆鏉′欢 + /// </summary> + public class SecurityInputCondition + { + /// <summary> + /// 灞炴��(鏉′欢)鍚嶇О + /// </summary> + public string key; + /// <summary> + /// 鎿嶄綔锛堟墽琛岋級鏉′欢 + /// < 灏忎簬 > 澶т簬 ==绛変簬 + /// </summary> + public string comparator; + /// <summary> + /// 鏉′欢鍊肩被鍨� + /// int \float\ string + /// </summary> + public string data_type = "string"; + /// <summary> + /// 鍊� + /// </summary> + public string value; + } + + /// <summary> + /// 瀹夐槻杈撳嚭 + /// </summary> + public class SecurityOutput + { + /// <summary> + /// 鎺у埗鐩爣绫诲瀷 + /// 璁惧锛�0锛屽満鏅�1锛岃嚜鍔ㄥ寲2 + /// </summary> + public string target_type; + /// <summary> + /// 杈撳嚭鐩爣鐨剆id + /// </summary> + public string sid; + /// <summary> + /// 瀹夐槻杈撳嚭鐘舵�� + /// </summary> + public List<SecurityOutputStatus> status = new List<SecurityOutputStatus>(); + } + /// <summary> + /// 瀹夐槻杈撳嚭鐘舵�� + /// </summary> + public class SecurityOutputStatus + { + public string key; + public string value; + } + + /// <summary> + /// 瀹夐槻閫氱煡閰嶇疆 + /// </summary> + public class SecurityNoticeConfig + { + /// <summary> + /// 鏄惁寮�鍚�氱煡 + /// </summary> + public bool enable; + /// <summary> + /// 閫氱煡鍐呭 + /// </summary> + public string noticeContent; + + } + /// <summary> + /// 瀹夐槻鎺ㄩ�侀厤缃� + /// </summary> + public class SecurityPushConfig + { + /// <summary> + /// 鎺ㄩ�佹柟寮� + /// APP:app push + /// SMS:鐭俊 + /// </summary> + public string pushMethod; + /// <summary> + /// 鎺ㄩ�佺洰鏍� + /// </summary> + public List<string> pushTarget = new List<string>(); + } +} diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 5725ed5..9f60e5f 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -101,7 +101,6 @@ return Functions.FindAll((obj) => spkList.Contains(obj.spk)); } - /// <summary> /// 绾㈠瀹濆垪琛� /// </summary> @@ -137,6 +136,11 @@ /// 鍦烘櫙鍒楄〃 /// </summary> public List<Scene> scenes = new List<Scene>(); + + /// <summary> + /// 瀹夐槻鍒楄〃 + /// </summary> + public List<Security> securities = new List<Security>(); /// <summary> /// 鍔犺浇鍔熻兘鍒楄〃 @@ -176,13 +180,40 @@ } Functions.Add(tempFunction); } - if (filePath.StartsWith("SceneData_")) + else if (filePath.StartsWith("SceneData_")) { var sceneDataBytes = FileUtlis.Files.ReadFile(filePath); var sceneDataString = System.Text.Encoding.UTF8.GetString(sceneDataBytes); var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(sceneDataString); List.scenes.Add(tempScene); } + else if (filePath.StartsWith("SecurityData_")) + { + var dataBytes = FileUtlis.Files.ReadFile(filePath); + var dataString = System.Text.Encoding.UTF8.GetString(dataBytes); + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<Security>(dataString); + if (temp == null) + { + MainPage.Log("null"); + FileUtlis.Files.DeleteFile(filePath); + return; + } + if (checkRepeat == true) + { + //妫�娴嬮噸澶� + for (int i = 0; i < securities.Count; i++) + { + if (securities[i].sid == temp.sid) + { + //鍏堢Щ闄ゆ帀鍐嶅姞 + securities.RemoveAt(i); + securities.Add(temp); + return; + } + } + } + securities.Add(temp); + } } /// <summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 198f53a..622e4e7 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -397,6 +397,8 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\ObjectClass.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\CatchSceneAddPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\CatchSceneCatchFunctionListPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\ArmCenterPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Entity\Function\Security.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> @@ -440,6 +442,6 @@ <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\" /> <Folder Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\" /> - <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Arm\" /> + <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\" /> </ItemGroup> </Project> \ No newline at end of file diff --git a/HDL_ON/UI/UI0-Public/TopViewDiv.cs b/HDL_ON/UI/UI0-Public/TopViewDiv.cs index 080a209..02a2f3d 100644 --- a/HDL_ON/UI/UI0-Public/TopViewDiv.cs +++ b/HDL_ON/UI/UI0-Public/TopViewDiv.cs @@ -340,7 +340,7 @@ /// <summary> /// 鎴愬憳椤堕儴鏍� /// </summary> - public void LoadTopView_MemberTopView(Action callBack, Action action) + public void LoadTopView_MemberTopView(Action addAction, Action action) { LoadTopView(); backAction = action; @@ -357,7 +357,30 @@ btnAddIcon.MouseUpEventHandler += (sender, e) => { - callBack?.Invoke(); + addAction?.Invoke(); + }; + } + /// <summary> + /// 瀹夐槻涓績椤堕儴鏍� + /// </summary> + public void LoadTopView_ArmCenter(Action skipAction)//(Action callBack, Action action) + { + //LoadTopView(); + //backAction = action; + + var btnAddIcon = new Button() + { + X = Application.GetRealWidth(337), + Y = Application.GetRealHeight(29), + Width = Application.GetMinRealAverage(28), + Height = Application.GetMinRealAverage(28), + UnSelectedImagePath = "FunctionIcon/ArmCenter/HistoryIcon.png", + }; + contentView.AddChidren(btnAddIcon); + + btnAddIcon.MouseUpEventHandler += (sender, e) => + { + skipAction?.Invoke(); }; } } diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 75aaa60..fdf56a2 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -507,9 +507,7 @@ } break; case ShowFunction.SecurityCenter: -#if DEBUG - functionCount = 1; -#endif + functionCount = FunctionList.List.securities.Count; break; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs index 352dc86..61abb45 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs @@ -1,5 +1,7 @@ 锘縰sing System; using System.Collections.Generic; +using System.Threading; +using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -19,6 +21,36 @@ private Button btnChooseZoneViewTitle; private VerticalScrolViewLayout functionListView; private Button btnComplete; + + #region 鍥炬爣閫夋嫨閮ㄥ垎鍥炬爣 + /// <summary> + /// 鑳屾櫙鍥鹃�夐」鍖哄煙 + /// </summary> + FrameLayout pictureOptionView; + /// <summary> + /// 鑳屾櫙鍥鹃�夐」閫夋嫨鍖哄煙 + /// </summary> + VerticalScrolViewLayout optionView; + /// <summary> + /// 榛樿鍥惧簱鎸夐挳 + /// </summary> + Button btnDefaultGallery; + /// <summary> + /// 鎷嶇収鎸夐挳 + /// </summary> + Button btnTakePicture; + /// <summary> + /// 鐩稿唽鎸夐挳 + /// </summary> + Button btnAlbum; + /// <summary> + /// 鍙栨秷鎸夐挳 + /// </summary> + Button btnCancel; + #endregion + + + /// <summary> /// 鎹曟崏鐨勫尯鍩熷垪琛� /// </summary> @@ -37,7 +69,6 @@ RemoveFromParent(); }; } - public void LoadPage() { @@ -74,6 +105,14 @@ //2020-12-03 淇敼鍥剧墖鍔犺浇鏂规硶 ImageUtlis.Current.LoadLocalOrNetworkImages(scene.ImagePath, addSceneImageView); + + /// <summary> + /// 淇敼鍦烘櫙鑳屾櫙浜嬩欢 + /// </summary> + addSceneImageView.MouseUpEventHandler = (sender, e) => + { + LoadPictureOptionView(); + }; #region 鍦烘櫙鍚嶇Оrow sceneNameView = new FrameLayout() @@ -174,71 +213,6 @@ BackgroundColor = CSS_Color.BackgroundColor, }); #endregion - #region 鍦烘櫙寤舵椂row - /* - if (DB_ResidenceData.Instance.GatewayType == 1) - { - FrameLayout sceneDelayRow = new FrameLayout() - { - Y = sceneNameView.Bottom, - Height = Application.GetRealWidth(50), - }; - contentView.AddChidren(sceneDelayRow); - - Button btnSceneDelayRight = new Button() - { - X = Application.GetRealWidth(339), - Gravity = Gravity.CenterVertical, - Width = Application.GetMinRealAverage(16), - Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/Right.png", - }; - sceneDelayRow.AddChidren(btnSceneDelayRight); - - var btnSceneDelayInfo = new Button() - { - Width = Application.GetRealWidth(327), - TextAlignment = TextAlignment.CenterRight, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = scene.GetDelayText() - }; - sceneDelayRow.AddChidren(btnSceneDelayInfo); - - Button btnSceneDelayTitle = new Button() - { - X = Application.GetRealWidth(16), - //Width = Application.GetRealWidth(90), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - TextID = StringId.SceneDelay, - }; - sceneDelayRow.AddChidren(btnSceneDelayTitle); - - btnSceneDelayTitle.MouseUpEventHandler = (sender, e) => - { - Action<string> action = (obj) => { - scene.delay = obj; - btnSceneDelayInfo.Text = scene.GetDelayText(); - }; - Dictionary<string, string> items = new Dictionary<string, string>(); - items.Add("30", "30s"); - items.Add("60", "1min"); - items.Add("120", "2min"); - items.Add("300", "5min"); - new PublicAssmebly().SetSceneDelayDialog(items, action, scene.delay); - }; - - contentView.AddChidren(new Button() - { - Y = sceneDelayRow.Bottom, - Height = Application.GetRealHeight(8), - BackgroundColor = CSS_Color.BackgroundColor, - }); - } - */ - #endregion #region 閫夋嫨鍖哄煙 FrameLayout chooseZoneView = new FrameLayout() @@ -273,8 +247,6 @@ BackgroundColor = CSS_Color.BackgroundColor, }; contentView.AddChidren(btnLine1); - - #endregion @@ -342,8 +314,6 @@ } }; } - - /// <summary> /// 鍔犺浇鍔熻兘鍒楄〃 @@ -432,6 +402,273 @@ } } + /// <summary> + /// 鍔犺浇鍥炬爣閫夋嫨閫夐」 + /// </summary> + void LoadPictureOptionView() + { + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + bodyView.AddChidren(pView); + + pictureOptionView = new FrameLayout() + { + Y = Application.GetRealHeight(445), + Height = Application.GetRealHeight(250), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + }; + pView.AddChidren(pictureOptionView); + + optionView = new VerticalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(150), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + pictureOptionView.AddChidren(optionView); + + btnDefaultGallery = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.DefaultGallery, + }; + optionView.AddChidren(btnDefaultGallery); + + optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); + + btnTakePicture = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.TakePicture, + }; + optionView.AddChidren(btnTakePicture); + + optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); + + btnAlbum = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.Album, + }; + optionView.AddChidren(btnAlbum); + + optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); + + 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, + }; + pictureOptionView.AddChidren(btnCancel); + + + LoadEvent_PictureOptionViewEventList(pView); + } + + /// <summary> + /// 鍔犺浇鑳屾櫙鍥鹃�夋嫨鍖哄煙浜嬩欢鍒楄〃 + /// </summary> + void LoadEvent_PictureOptionViewEventList(FrameLayout pView) + { + pictureOptionView.MouseUpEventHandler = (sender, e) => + { + pictureOptionView.Parent.RemoveFromParent(); + }; + pView.MouseUpEventHandler = (sender, e) => + { + pictureOptionView.Parent.RemoveFromParent(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + pictureOptionView.Parent.RemoveFromParent(); + }; + btnTakePicture.MouseDownEventHandler = (sender, e) => { + btnTakePicture.IsSelected = true; + }; + btnTakePicture.MouseUpEventHandler = (sender, e) => + { + btnTakePicture.IsSelected = false; + + var imageName = Guid.NewGuid().ToString(); + CropImage.TakePicture((imagePath) => + { + CropImageCallBack(imagePath); + + }, imageName, 4, 3); + + pictureOptionView.Parent.RemoveFromParent(); + }; + btnAlbum.MouseDownEventHandler = (sender, e) => { + btnAlbum.IsSelected = true; + }; + + btnAlbum.MouseUpEventHandler = (sender, e) => + { + btnAlbum.IsSelected = false; + + //浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀 + var imageName = Guid.NewGuid().ToString(); + //var imageName = scene.sid; + CropImage.SelectPicture((imagePath) => + { + CropImageCallBack(imagePath); + }, imageName, 4, 3); + + + //if (pageTitleId == StringId.EditScene) + //{ + // scene.SaveFunctionData(); + //} + pictureOptionView.Parent.RemoveFromParent(); + }; + + btnDefaultGallery.MouseUpEventHandler = (sender, e) => { + pictureOptionView.Parent.RemoveFromParent(); + Action<string> action = (obj) => { + scene.ImagePath = obj; + addSceneImageView.ImageBytes = null;//瑙e喅鏈塈mageBytes涓嶅姞杞絀magePath + addSceneImageView.ImagePath = scene.ImagePath; + }; + + var galleryPage = new GalleryPage(scene.ImagePath, action); + MainPage.BasePageView.AddChidren(galleryPage); + galleryPage.LoadPage(true); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + } + + /// <summary> + /// 瑁佸壀瀹岀収鐗囧洖璋冿紝缁熶竴澶勭悊 + /// </summary> + /// <param name="imagePath">瑁佸壀鍚庣殑鐪熷疄璺緞</param> + /// <param name="imageName">鑷畾涔夌殑鍥剧墖鍚嶇О</param> + void CropImageCallBack(string selectImagePath) + { + if (string.IsNullOrEmpty(selectImagePath) == true) + { + return; + } + + //涓婁紶鎴愬姛鍒板洖璋� + Action<string> uploadSuccessAction = (imageUrl) => + { + //2020-12-03 闇�瑕佽鏈�鏂扮殑鍥剧墖璺緞鍚屾鍒颁簯绔� + scene.ImagePath = imageUrl; + }; + //涓婁紶鍥剧墖鍒颁簯绔� + UploadImage(selectImagePath, addSceneImageView, scene, uploadSuccessAction); + } + + /// <summary> + /// 涓婁紶鍥剧墖鏂规硶 + /// </summary> + /// <param name="selectImagePath">瑁佸壀鍚庣殑鍥剧墖璺緞</param> + /// <param name="imageView"></param> + /// <param name="uploadSuccessAction"></param> + void UploadImage(string selectImagePath, ImageView imageView, Scene mScene, Action<string> uploadSuccessAction) + { + try + { + //MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + selectImagePath); + //1.璇诲彇瑁佸壀鍚庣殑鍥剧墖锛岀劧鍚庡垹闄� + var imageBytes = Shared.IO.FileUtils.ReadFile(selectImagePath); + System.IO.File.Delete(selectImagePath); + + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + //寮�濮嬩笂浼� + new Thread(() => + { + try + { + var newImageName = mScene.name.Trim() + ".png"; + var uploadImageObj = new UploadImageObj() + { + prefix = "Scene" + Utlis.GetTimestamp(), + fileName = newImageName, + uid = mScene.sid, + content = imageBytes, + }; + + var imageUrl = ImageUtlis.Current.UploadImage(uploadImageObj); + if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Contains(newImageName)) + { + //涓婁紶鎴愬姛 + Application.RunOnMainThread(() => + { + //Utlis.WriteLine("涓婁紶鎴愬姛锛�" + imageUrl); + //1.2濡傛灉鏄嚜瀹氫箟鍥剧墖鍒犻櫎涔嬪墠鐨� + if (!string.IsNullOrEmpty(imageView.ImagePath) && !imageView.ImagePath.Contains("Classification/Room/Roombg")) + { + //Utlis.WriteLine("鍒犻櫎: " + imageView.ImagePath); + System.IO.File.Delete(imageView.ImagePath); + } + //閲嶅懡鍚嶄繚瀛� + ImageUtlis.Current.WriteFileByBytes(imageUrl, imageBytes); + imageView.ImagePath = null; + imageView.ImageBytes = imageBytes; + //涓婁紶鎴愬姛 + Utlis.ShowTip(Language.StringByID(StringId.UploadSuccessfully)); + uploadSuccessAction?.Invoke(imageUrl); + }); + } + else + { + //涓婁紶澶辫触 + Application.RunOnMainThread(() => + { + //涓婁紶澶辫触 + Utlis.ShowTip(Language.StringByID(StringId.UploadFailed)); + }); + } + + } + catch (Exception ex) + { + } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + } + catch { } + } } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs new file mode 100644 index 0000000..d80b17d --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs @@ -0,0 +1,128 @@ +锘縰sing System; +using HDL_ON.UI.CSS; +using Shared; +namespace HDL_ON.UI.UI2.FuntionControlView.ArmCenter +{ + public class ArmCenterPage : FrameLayout + { + /// <summary> + /// 涓荤獥浣� + /// </summary> + FrameLayout bodyView; + public ArmCenterPage() + { + bodyView = this; + } + + public void LoadPage() + { + Action skipAction = () => { + + }; + + new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView_ArmCenter(skipAction); + + VerticalScrolViewLayout contentView = new VerticalScrolViewLayout() + { + Height = Application.GetRealHeight(603), + BackgroundColor = CSS_Color.MainBackgroundColor, + ScrollEnabled = false, + }; + bodyView.AddChidren(contentView); + + contentView.AddChidren(new Button() + { + Height =Application.GetRealWidth(32), + }); + + //瀹夐槻鐘舵�佽儗鏅浘 + Button 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); + + contentView.AddChidren(new Button() + { + Height = Application.GetRealWidth(16), + }); + + //鑷畾涔夊竷闃叉爣棰� + Button btnCustomDeploymentTitle = new Button() + { + X = Application.GetRealWidth(24), + Height = Application.GetRealWidth(54), + TextAlignment = TextAlignment.CenterLeft, + IsBold = true, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + TextID = StringId.CustomDeployment, + }; + contentView.AddChidren(btnCustomDeploymentTitle); + + HorizontalScrolViewLayout customDeploymentView = new HorizontalScrolViewLayout() + { + X = Application.GetRealWidth(23), + Height = Application.GetRealWidth(80), + }; + contentView.AddChidren(customDeploymentView); + + + + + + + + } + } + + + /// <summary> + /// 瀹夐槻鑷畾涔夋帶浠� + /// </summary> + public class ArmDiyView + { + public FrameLayout ArmDiyButton; + + /// <summary> + /// + /// </summary> + /// <param name="IconPath">鍥剧墖璺緞</param> + /// <param name="Text">鏄剧ず鏂囨湰</param> + public ArmDiyView(string UnSelectedIconPath, string SelectedIconPath, string Text) + { + ArmDiyButton = new FrameLayout() + { + Width = Application.GetRealWidth(82), + Height = Application.GetRealWidth(80), + }; + + Button btnIcon = new Button() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(40), + Height = Application.GetRealWidth(40), + UnSelectedImagePath = UnSelectedIconPath, + SelectedImagePath = SelectedIconPath, + }; + ArmDiyButton.AddChidren(btnIcon); + + Button btnText = new Button() + { + Y = Application.GetRealWidth(40), + Height = Application.GetRealWidth(41), + Text = Text, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + ArmDiyButton.AddChidren(btnText); + + } + + } +} -- Gitblit v1.8.0