| | |
| | | <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"> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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 /> |
| | |
| | | <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" /> |
| | |
| | | <?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" />--> |
| | |
| | | <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" /> |
| | |
| | | 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 |
| | |
| | | 493=重置面容 |
| | | 494=设置面容 |
| | | 495=人脸通行设置 |
| | | 496=还没有关联任何布防状态 |
| | | 497=自定义 |
| | | 498=触发延时 |
| | | 499=添加布防功能 |
| | | 500=添加告警目标 |
| | | |
| | | 1000=室内湿度 |
| | | 1001=童锁 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //======================安防==================== |
| | | GetSecurityList(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | 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(); |
| | |
| | | { |
| | | 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> |
| | | /// 设置面容 |
| | |
| | | {
|
| | | //全部
|
| | | btnFloorName.Text = Language.StringByID(StringId.All);
|
| | | btnFloorName.Width = btnFloorName.GetTextWidth();
|
| | | //btnFloorName.Width = btnFloorName.GetTextWidth();
|
| | | }
|
| | | //房间
|
| | | else if (selectType == 3)
|
| | |
| | | return $"/user/{Control.Ins.GatewayId}/custom/scene/execute"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 安防控制 |
| | | /// </summary> |
| | | public string ControlSeurity |
| | | { |
| | | get |
| | | { |
| | | return $"/user/{Control.Ins.GatewayId}/custom/security/status/set"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <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> |
| | |
| | | //TODO 暂时不传正确的数据上去,如果后面要优化前面这些代码 |
| | | 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 |
| | | { |
| | | //一些特殊的主题处理(为了执行速度,尽可能的别加耗时的操作) |
| | |
| | | /// 公共域名就近解析 |
| | | /// |
| | | /// </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> |
| | |
| | | /// </summary> |
| | | public string MasterToken; |
| | | |
| | | //RegionInfoRes _residecenInfo; |
| | | RegionInfoRes _residecenInfo = new RegionInfoRes(); |
| | | /// <summary> |
| | | /// 住宅基础信息 |
| | |
| | | public HomeGatewayInfo HomeGateway; |
| | | |
| | | /// <summary> |
| | | /// 0:bus网关 |
| | | /// 1:A协议网关 |
| | | /// 0:一端口 |
| | | /// 1:Link协议网关 |
| | | /// </summary> |
| | | public int GatewayType |
| | | { |
| | |
| | | //#endif |
| | | if (HomeGateway == null) |
| | | return -1; |
| | | if (HomeGateway.gatewayType == "AGATEWAY") |
| | | if (HomeGateway.gatewayType != "BUSUDPGATEWAY") |
| | | { |
| | | return 1; |
| | | } |
| | |
| | | /// 收藏标记 |
| | | /// </summary> |
| | | public bool collect = false; |
| | | /// <summary> |
| | | /// 是否允许删除 |
| | | /// </summary> |
| | | public bool can_delete = true; |
| | | |
| | | /// <summary> |
| | | /// 创建该场景的用户ID |
| | |
| | | /// <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: |
| | |
| | | using 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布防、disable撒防 |
| | | /// </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> |
| | |
| | | /// <summary> |
| | | /// 状态 enable布防、disable撒防 |
| | | /// </summary> |
| | | public string status; |
| | | public string status = "disable"; |
| | | /// <summary> |
| | | /// 类型 |
| | | /// "all"--全宅布防, |
| | |
| | | /// "all_day":24小时, |
| | | /// "mute":静音 |
| | | /// </summary> |
| | | public string type; |
| | | public string type = "normal"; |
| | | /// <summary> |
| | | /// 更新时间 |
| | | /// </summary> |
| | |
| | | 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> |
| | |
| | | public string bypass; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 安防输入 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public List<SecurityInputCondition> condition = new List<SecurityInputCondition>(); |
| | | |
| | | /// <summary> |
| | | /// 加入输入条件 |
| | | /// 本地判断使用 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public bool addCondition = false; |
| | | |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | Function _function = null; |
| | | /// <summary> |
| | |
| | | _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> |
| | |
| | | /// </summary> |
| | | public List<SecurityOutputStatus> status = new List<SecurityOutputStatus>(); |
| | | |
| | | /// <summary> |
| | | /// 加入输入条件 |
| | | /// 本地判断使用 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public bool addCondition = false; |
| | | |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | Function _function = null; |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 安防列表 |
| | | /// </summary> |
| | | public List<SecurityAlarm> securities = new List<SecurityAlarm>(); |
| | | public List<SecurityAlarm> securities |
| | | { |
| | | get |
| | | { |
| | | return SecurityCenter.Security.securityAlarmList; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载功能列表 |
| | |
| | | <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\" />
|
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string VersionString = "1.2.0817"; |
| | | public static string VersionString = "1.2.0820"; |
| | | ///// <summary> |
| | | ///// 客户端类型 |
| | | ///// </summary> |
| | |
| | | /// </summary> |
| | | Button btnLinkStateTip; |
| | | /// <summary> |
| | | /// 安防状态图标 |
| | | /// </summary> |
| | | Button btnSecurityStatus; |
| | | |
| | | |
| | | /// <summary> |
| | | ///住宅名称显示 |
| | | /// </summary> |
| | | Button btnResidenceName; |
| | |
| | | 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() |
| | |
| | | // }, |
| | | //}); |
| | | |
| | | //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>() { |
| | |
| | | /// </summary> |
| | | public static void LoadEvent_RefreshAir() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | 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> |
| | |
| | | break; |
| | | case ShowFunction.SecurityCenter: |
| | | functionCount = FunctionList.List.securities.Count; |
| | | #if DEBUG |
| | | if (DB_ResidenceData.Instance.GatewayType == 1) |
| | | { |
| | | functionCount = 1; |
| | | #endif |
| | | } |
| | | break; |
| | | |
| | | } |
| | |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | //IsBold = true |
| | | }; |
| | | if (scene.can_delete) |
| | | { |
| | | bodyView.AddChidren(btnComplete); |
| | | |
| | | } |
| | | LoadEventList(); |
| | | |
| | | var waitPage = new Loading(); |
| | |
| | | /// <summary> |
| | | /// 显示功能Row |
| | | /// </summary> |
| | | /// <param name="showUnallocated">是否是显示未分配</param> |
| | | void LoadFunctionListRow(List<Function> functions) |
| | | { |
| | | functionListView.RemoveAll(); |
New file |
| | |
| | | using 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; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using 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; |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | using 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); |
| | | }; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | //using System; |
| | | //using System.Collections.Generic; |
| | | //using HDL_ON.Entity; |
| | | //using HDL_ON.UI.CSS; |
| | | //using Shared; |
| | | |
| | | //namespace HDL_ON.UI |
| | | //{ |
| | | // public class 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 |
| | | |
| | | // } |
| | | //} |
| | |
| | | using System; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | /// 主窗体 |
| | | /// </summary> |
| | | FrameLayout bodyView; |
| | | /// <summary> |
| | | /// 自定义布防区域 |
| | | /// </summary> |
| | | HorizontalScrolViewLayout customDeploymentView; |
| | | |
| | | public ArmCenterPage() |
| | | { |
| | | bodyView = this; |
| | |
| | | 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() |
| | |
| | | }; |
| | | contentView.AddChidren(btnCustomDeploymentTitle); |
| | | |
| | | HorizontalScrolViewLayout customDeploymentView = new HorizontalScrolViewLayout() |
| | | customDeploymentView = new HorizontalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(23), |
| | | Height = Application.GetRealWidth(80), |
| | |
| | | }; |
| | | 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() |
| | |
| | | Height = Application.GetRealHeight(20), |
| | | }); |
| | | |
| | | #region 固定布防区域 |
| | | /* |
| | | var fixedDeploymentView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(133), |
| | |
| | | }; |
| | | fixedDeploymentView.AddChidren(btnFixedDeploymentTip); |
| | | |
| | | //固定布防区域 |
| | | var fixedDeploymentTypeView = new HorizontalScrolViewLayout() |
| | | { |
| | | Y = btnFixedDeploymentTip.Bottom + Application.GetRealHeight(15), |
| | |
| | | Width = Application.GetRealWidth(24), |
| | | }); |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | //灾害报警 |
| | |
| | | //防盗报警 |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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; |
| | |
| | | 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() |
| | |
| | | |
| | | 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); |
| | | |
| | |
| | | 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), |
| | |
| | | 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() |
| | | { |
| | |
| | | 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> |
| | | /// 修改安防名称 |
| | |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 }; |
| | | }; |
| | | } |
| | | |