44个文件已添加
120个文件已修改
1 文件已重命名
| | |
| | | { |
| | | Language.CurrentLanguage = "English"; |
| | | } |
| | | Language.CurrentLanguage = "English"; |
| | | |
| | | //获取极光推送ID |
| | | GetJPushRegistrationID(activity); |
| | |
| | | 1084=1st Gear |
| | | 1085=2nd Gear |
| | | 1086=3rd Gear |
| | | 1087=Unlock |
| | | 1088=Temp. Password |
| | | 1089=Connected |
| | | 1090=Disconnected |
| | | 1091=Generate |
| | | 1092=Effective time |
| | | 1093=Expire time |
| | | 1094=Select time |
| | | 1095=Select Date |
| | | 1096=Generate |
| | | 1097=Temporary password has been copied |
| | | 1098=Clear Password? |
| | | 1099=The expire time must be later than the effective time |
| | | 1100=Unlock Method |
| | | 1101=It'll synchronize with actual lock, confirm to delete? |
| | | 1102=Delete |
| | | 1103=Remark |
| | | 1104=The remark can not be blank. |
| | | 1105=Assign to |
| | | 1106=Target Scene Not Exist |
| | | 1107=Select Scene |
| | | 1108=Unlock |
| | | 1109=Always On |
| | | 1110=Setting |
| | | 1111=Automation |
| | | 1112=Turn on "Always On" Mode |
| | | 1113=Turn off "Always On" Mode |
| | | 1114=Edit |
| | | 1115=Always On will be off at {0} |
| | | 1116=Condition |
| | | 1117=Motion |
| | | 1118=Always On |
| | | 1119=Lock |
| | | 1120=User |
| | | 1121=Unlock Method |
| | | 1122=Fingerprint |
| | | 1123=Card |
| | | 1124=Key |
| | | 1125=Information |
| | | 1126=Unlock |
| | | 1127=Alarm |
| | | 1128=Offline |
| | | 1129=For first user, Please bind lock password |
| | | 1130=Please enter admin password |
| | | 1131=Bind Successfully |
| | | 1132=Skip to personal password for unlock |
| | | 1133=Skip |
| | | 1134=Please draw your pattern |
| | | 1135=Lock will be always on after setting, confirm to proceed |
| | | 1136=Confirm |
| | | 1137=Expire |
| | | 1138=Always On will expire after {0} hours |
| | | 1139=Please enter expire time |
| | | 1140=Expire time should not be more than 72 hours |
| | | 1141=Expire time should not be less than 1 hour |
| | | 1142=Fail to set, please try again |
| | | |
| | | |
| | | 5000=Music |
| | | 5001=Group |
| | |
| | | 1084=风速1档 |
| | | 1085=风速2档 |
| | | 1086=风速3档 |
| | | |
| | | 1087=一键开锁 |
| | | 1087=Unlock |
| | | 1088=临时密码开锁 |
| | | 1088=Temp. Password |
| | | 1089=已连接 |
| | | 1089=Connected |
| | | 1090=未连接 |
| | | 1090=Disconnected |
| | | 1091=生成临时密码 |
| | | 1091=Generate |
| | | 1092=生效时间 |
| | | 1092=Effective time |
| | | 1093=失效时间 |
| | | 1093= |
| | | 1094=选择时间 |
| | | 1095=选择日期 |
| | | 1096=Generate |
| | | 1097=临时密码已经复制 |
| | | 1098=清除当前临时密码? |
| | | 1099=生效时间必须大于失效时间 |
| | | 1100=开锁方式管理 |
| | | 1101=删除操作将被同步于实体锁上{0}是否还需要删除? |
| | | 1102=确认删除 |
| | | 1103=修改备注名称 |
| | | 1104=备注名称不能为空 |
| | | 1105=分配至 |
| | | 1106=检测不到可供选择的场景 |
| | | 1107=选择场景 |
| | | 1108=锁已打开 |
| | | 1109=常开 |
| | | 1110=时效性常开设置 |
| | | 1111=常开自动化 |
| | | 1112=打开常开模式 |
| | | 1113=关闭常开模式 |
| | | 1114=编辑 |
| | | 1115=常开模式将于{0}关闭 |
| | | 1116=条件 |
| | | 1117=动作 |
| | | 1118=常开模式 |
| | | 1119=锁 |
| | | 1120=用户 |
| | | 1121=开锁方式 |
| | | 1122=指纹 |
| | | 1123=卡 |
| | | 1124=钥匙 |
| | | 1125=信息类型 |
| | | 1126=开锁信息 |
| | | 1127=报警类信息 |
| | | 1128=设备不在线 |
| | | 1129=第一次使用,请先绑定门锁密码 |
| | | 1130=请输入门锁管理员密码 |
| | | 1131=门锁绑定成功 |
| | | 1132=为了安全,请跳转至个人中心{0}设置个人密码,并应用于门锁开锁 |
| | | 1133=跳转 |
| | | 1134=请绘制图案 |
| | | 1135=设置常开模式后{0}您的门锁将处于打开状态{0}是否继续开启 |
| | | 1136=确认开启 |
| | | 1137=失效设置 |
| | | 1138=常开模式将于{0}小时后失效 |
| | | 1139=请输入失效时间 |
| | | 1140=失效时间不能大于72小时 |
| | | 1141=失效时间不能小于1小时 |
| | | 1142=常开模式关闭设置失效,请重试 |
| | | |
| | | |
| | | 4000=可视对讲 |
| | |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\answer.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\back_icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\dialog_background.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\hangup.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\mic.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\screenshot_def.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\screenshot_sel.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\screenshot.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\sure_background_def.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\sure_background_sel.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\tip_background.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\unlock_def.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\unlock_sel.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\unlock.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\video_background.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\activity_video_phone.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\dialog_tip.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\fragment_call.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\fragment_monitor.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\values-zh\strings.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Folder Include="Resources\drawable\" /> |
| | | <Folder Include="Resources\layout\" /> |
| | | <Folder Include="Assets\Phone\Intelligence\" /> |
| | | <Folder Include="Assets\Phone\DeviceIcon\" /> |
| | | <Folder Include="Other\" /> |
| | | <Folder Include="Other\JPush\" /> |
| | | <Folder Include="Assets\Phone\FunctionIcon\Electrical\WaterValve\" /> |
| | | <Folder Include="Assets\Phone\FunctionIcon\Electrical\ClothesHanger\" /> |
| | | <Folder Include="Assets\Phone\PirIcon\" /> |
| | | <Folder Include="Assets\Phone\VideoIcon\" /> |
| | | <Folder Include="Assets\Phone\FunctionIcon\Energy\" /> |
| | | <AndroidAsset Include="Assets\Phone\Public\MsgIcon\TipSuccessIcon.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup /> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\BindScene.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" /> |
| | | <PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" /> |
| | |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\AirCleanerThiinIcon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\WeepRobotThinIcon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\WeepRobot\MuteSelect.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\WeepRobot\Battery.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\WeepRobot\ControlRight.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\WeepRobot\AreaMode.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\WeepRobot\AutoMode.png" /> |
| | |
| | | <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> |
| | | <AndroidNativeLibrary Include="libs\armeabi-v7a\libjcore127.so" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Connect.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Delete.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Editor.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Hide.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\More.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Mute.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\NormallyOpenIcon1.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\NormallyOpenIcon2.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Redistribution.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Screen.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Shard.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\UnConnect.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\UnLockManager.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\Voice.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\Public\BatteryEnough.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\Public\BatteryNot.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\LockPictrue1.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\LockPictrue2.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\UnLockPictrue1.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\UnLockPictrue2.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\UnLockPictrue3.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\CrearPswBackgroud.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\NormallyOpenIcon3.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\History.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\DoorLock.png" /> |
| | | </ItemGroup> |
| | | <Import Project="..\HDL_ON\HDL_ON.projitems" Label="Shared" Condition="Exists('..\HDL_ON\HDL_ON.projitems')" /> |
| | | <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> |
| | | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
| | |
| | | #pragma warning disable 1591 |
| | | //------------------------------------------------------------------------------ |
| | | // <auto-generated> |
| | | // This code was generated by a tool. |
| | | // 此代码由工具生成。 |
| | | // 运行时版本:4.0.30319.42000 |
| | | // |
| | | // Changes to this file may cause incorrect behavior and will be lost if |
| | | // the code is regenerated. |
| | | // 对此文件的更改可能会导致不正确的行为,并且如果 |
| | | // 重新生成代码,这些更改将会丢失。 |
| | | // </auto-generated> |
| | | //------------------------------------------------------------------------------ |
| | | |
| | |
| | | { |
| | | |
| | | |
| | | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
| | | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
| | | public partial class Resource |
| | | { |
| | | |
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
| | |
| | | /// <summary>
|
| | | /// 风速3档
|
| | | /// </summary> |
| | | public const int FanThreeGear = 1086; |
| | | public const int FanThreeGear = 1086;
|
| | | /// <summary>
|
| | | /// 一键开锁
|
| | | /// </summary> |
| | | public const int OneKeyUnlocking = 1087;
|
| | | /// <summary>
|
| | | /// 临时密码开锁
|
| | | /// </summary> |
| | | public const int TemporaryPasswordUnlocking = 1088;
|
| | | /// <summary>
|
| | | /// 已连接
|
| | | /// </summary> |
| | | public const int Connected = 1089;
|
| | | /// <summary>
|
| | | /// 未连接
|
| | | /// </summary> |
| | | public const int UnConnected = 1090;
|
| | | /// <summary>
|
| | | /// 生成临时密码
|
| | | /// </summary> |
| | | public const int CreatTemporaryPassword = 1091;
|
| | | /// <summary>
|
| | | /// 生效时间
|
| | | /// </summary> |
| | | public const int EffectiveTime = 1092;
|
| | | /// <summary>
|
| | | /// 失效时间
|
| | | /// </summary> |
| | | public const int FailureTime = 1093;
|
| | | /// <summary>
|
| | | /// 选择时间
|
| | | /// </summary> |
| | | public const int SelectTime = 1094;
|
| | | /// <summary>
|
| | | /// 选择日期
|
| | | /// </summary> |
| | | public const int SelectDate = 1095; |
| | | /// <summary>
|
| | | /// 生成
|
| | | /// </summary> |
| | | public const int Generate = 1096;
|
| | | /// <summary>
|
| | | /// 临时密码已经复制
|
| | | /// </summary> |
| | | public const int TempPsswordHasBeenCopy = 1097;
|
| | | /// <summary>
|
| | | /// 清除当前临时密码?
|
| | | /// </summary> |
| | | public const int ClearTempPsswordMsg = 1098;
|
| | | /// <summary>
|
| | | /// 生效时间必须大于失效时间
|
| | | /// </summary> |
| | | public const int EffectiveTimeMustBeOverFailureTime = 1099;
|
| | | /// <summary>
|
| | | /// 开锁方式管理
|
| | | /// </summary> |
| | | public const int UnlockingManagement = 1100;
|
| | | /// <summary>
|
| | | /// 删除操作将被同步于实体锁上是否还需要删除?
|
| | | /// </summary> |
| | | public const int DeleteUnlockingMethordMsg = 1101; |
| | | /// <summary>
|
| | | /// 确认删除
|
| | | /// </summary> |
| | | public const int ConfirmDeletion = 1102;
|
| | | /// <summary>
|
| | | /// 修改备注名称
|
| | | /// </summary> |
| | | public const int EditorRemarkName = 1103;
|
| | | /// <summary>
|
| | | /// 备注名称不能为空
|
| | | /// </summary> |
| | | public const int RemarkNameCanNotEmpty = 1104; |
| | | /// <summary>
|
| | | /// 分配至
|
| | | /// </summary> |
| | | public const int AssignTo = 1105; |
| | | /// <summary>
|
| | | /// 检测不到可供选择的场景
|
| | | /// </summary> |
| | | public const int NotHadCanSelectScene = 1106;
|
| | | /// <summary>
|
| | | /// 选择场景
|
| | | /// </summary> |
| | | public const int SelectScene = 1107;
|
| | | /// <summary>
|
| | | /// 锁已打开
|
| | | /// </summary> |
| | | public const int LockIsOpened = 1108; |
| | | /// <summary>
|
| | | /// 常开
|
| | | /// </summary> |
| | | public const int AlwaysOn = 1109; |
| | | /// <summary>
|
| | | /// 时效性常开设置
|
| | | /// </summary> |
| | | public const int TimelyAlwaysOnSetting = 1110; |
| | | /// <summary>
|
| | | /// 常开自动化
|
| | | /// </summary> |
| | | public const int AutomationAlwaysOn = 1111;
|
| | | /// <summary>
|
| | | /// 打开常开模式
|
| | | /// </summary> |
| | | public const int OpenAlwaysOnModel = 1112;
|
| | | /// <summary>
|
| | | /// 关闭常开模式
|
| | | /// </summary> |
| | | public const int CloseAlwaysOnModel = 1113;
|
| | | /// <summary>
|
| | | /// 编辑
|
| | | /// </summary> |
| | | public const int Edit = 1114; |
| | | /// <summary>
|
| | | /// 常开模式将于{0}关闭
|
| | | /// </summary> |
| | | public const int AlwaysOnWillCloseOnTime = 1115;
|
| | | /// <summary>
|
| | | /// 条件
|
| | | /// </summary> |
| | | public const int Condtion = 1116; |
| | | /// <summary>
|
| | | /// 动作
|
| | | /// </summary> |
| | | public const int Action = 1117; |
| | | /// <summary>
|
| | | /// 常开模式
|
| | | /// </summary> |
| | | public const int AlwaysOnModel = 1118;
|
| | | /// <summary>
|
| | | /// 锁
|
| | | /// </summary> |
| | | public const int Lock = 1119;
|
| | | /// <summary>
|
| | | /// 用户
|
| | | /// </summary> |
| | | public const int User = 1120;
|
| | | /// <summary>
|
| | | /// 开锁方式
|
| | | /// </summary> |
| | | public const int UnlockingMode = 1121;
|
| | | /// <summary>
|
| | | /// 指纹
|
| | | /// </summary> |
| | | public const int Fingerprints = 1122;
|
| | | /// <summary>
|
| | | /// 卡
|
| | | /// </summary> |
| | | public const int Card = 1123;
|
| | | /// <summary>
|
| | | /// 钥匙
|
| | | /// </summary> |
| | | public const int Key = 1124;
|
| | | /// <summary>
|
| | | /// 信息类型
|
| | | /// </summary> |
| | | public const int MessageType = 1125;
|
| | | /// <summary>
|
| | | /// 开锁信息
|
| | | /// </summary> |
| | | public const int UnlockingMessage = 1126;
|
| | | /// <summary>
|
| | | /// 报警类信息
|
| | | /// </summary> |
| | | public const int AlarmMessage = 1127;
|
| | | /// <summary>
|
| | | /// 设备不在线
|
| | | /// </summary> |
| | | public const int DeviceNotOnline = 1128;
|
| | | /// <summary>
|
| | | /// 第一次使用,请先绑定门锁密码
|
| | | /// </summary> |
| | | public const int PleaseBindTheDoorPswFirst = 1129; |
| | | /// <summary>
|
| | | /// 请输入门锁管理员密码
|
| | | /// </summary> |
| | | public const int PleaseInputDoorAdminPassword = 1130;
|
| | | /// <summary>
|
| | | /// 门锁绑定成功
|
| | | /// </summary> |
| | | public const int BindDoorLockSuccess = 1131; |
| | | /// <summary>
|
| | | /// 为了安全,请跳转至个人中心{0}设置个人密码,并应用于门锁开锁
|
| | | /// </summary> |
| | | public const int JumpToPersonalCentetToSetPasswordMsg = 1132; |
| | | /// <summary>
|
| | | /// 跳转
|
| | | /// </summary> |
| | | public const int Jump = 1133;
|
| | | /// <summary>
|
| | | /// 请绘制图案
|
| | | /// </summary> |
| | | public const int PleaseDrawPattern = 1134;
|
| | | /// <summary>
|
| | | /// 设置常开模式后{0}您的门锁将处于打开状态{0}是否继续开启
|
| | | /// </summary> |
| | | public const int OpenAlwayOnConfirmMsg = 1135;
|
| | | /// <summary>
|
| | | /// 确认开启
|
| | | /// </summary> |
| | | public const int ConfirmOpen = 1136;
|
| | | /// <summary>
|
| | | /// 失效设置
|
| | | /// </summary> |
| | | public const int FailTimeSeetion = 1137;
|
| | | /// <summary>
|
| | | /// 常开模式将于{0}小时后失效
|
| | | /// </summary> |
| | | public const int AlwayOnWillCloseAtTimeMsg = 1138;
|
| | | /// <summary>
|
| | | /// 请输入失效时间
|
| | | /// </summary> |
| | | public const int PleaseInputFailTime = 1139;
|
| | | /// <summary> |
| | | /// 失效时间不能大于72小时 |
| | | /// </summary> |
| | | public const int InvalidTimeMoreThan72 = 1140; |
| | | /// <summary> |
| | | /// 失效时间不能小于1小时 |
| | | /// </summary> |
| | | public const int InvalidTimeLessThan1 = 1141;
|
| | | /// <summary> |
| | | /// 常开模式关闭设置失效,请重试 |
| | | /// </summary> |
| | | public const int AlwayOnFailTimeSettionFailMsg = 1142; |
| | | |
| | | |
| | | |
| | | public const int keshiduijiang = 4000; |
| | |
| | | {
|
| | | //全部
|
| | | btnFloorName.Text = Language.StringByID(StringId.All);
|
| | | btnFloorName.Width = btnFloorName.GetTextWidth();
|
| | | }
|
| | | //房间
|
| | | else if (selectType == 3)
|
| | |
| | | if (roomInfo.uid == this.nowShowSelectId)
|
| | | {
|
| | | btnFloorName.Text = roomInfo.floorName + roomInfo.roomName;
|
| | | btnFloorName.Width = btnFloorName.GetTextWidth();
|
| | | return;
|
| | | }
|
| | | }
|
| | |
| | | if (floorInfo.uid == this.nowShowSelectId)
|
| | | {
|
| | | btnFloorName.Text = floorInfo.roomName;
|
| | | btnFloorName.Width = btnFloorName.GetTextWidth();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return pack; |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 门锁历史记录________________________ |
| | | |
| | | /// <summary> |
| | | /// 获取门锁历史记录(按日期降序) |
| | | /// </summary> |
| | | /// <param name="i_device">设备对象</param> |
| | | /// <returns></returns> |
| | | public List<Stan.DoorHistoryLog> GetDoorHistoryLogs(Function i_device) |
| | | { |
| | | //测试 |
| | | var listLog = new List<Stan.DoorHistoryLog>(); |
| | | for (int i = 1; i <= 3; i++) |
| | | { |
| | | var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" }; |
| | | logInfo.Time = new DateTime(2000, 5, 6, 10, 45, 23).AddDays(i); |
| | | listLog.Add(logInfo); |
| | | } |
| | | for (int i = 1; i <= 3; i++) |
| | | { |
| | | var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" }; |
| | | logInfo.Time = new DateTime(2001, 5, 6, 10, 45, 23).AddDays(i); |
| | | listLog.Add(logInfo); |
| | | } |
| | | for (int i = 1; i <= 3; i++) |
| | | { |
| | | var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" }; |
| | | logInfo.Time = new DateTime(2002, 5, 6, 10, 45, 23).AddDays(i); |
| | | listLog.Add(logInfo); |
| | | } |
| | | |
| | | //按时间降序 |
| | | var listSortLog = new List<Stan.DoorHistoryLog>(); |
| | | foreach (var logInfo in listLog) |
| | | { |
| | | bool canAdd = true; |
| | | for (int i = 0; i < listSortLog.Count; i++) |
| | | { |
| | | if (logInfo.Time > listSortLog[i].Time) |
| | | { |
| | | //时间比当前的索引大,则插入到它的前面 |
| | | listSortLog.Insert(i, logInfo); |
| | | canAdd = false; |
| | | break; |
| | | } |
| | | } |
| | | if (canAdd == true) |
| | | { |
| | | //日期最小,则添加到末尾 |
| | | listSortLog.Add(logInfo); |
| | | } |
| | | } |
| | | //提示 |
| | | //IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); |
| | | return listSortLog; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | urlHead = OnAppConfig.Instance.RequestHttpsHost; |
| | | } |
| | | //"https://bahrain-gateway.hdlcontrol.com"; |
| | | urlHead="https://china-gateway.hdlcontrol.com"; |
| | | //urlHead="https://china-gateway.hdlcontrol.com"; |
| | | string requestFullUrl = urlHead + apiPath; |
| | | |
| | | |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)Entity\Function\Function.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\PublicAssmebly.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\CSS\CSS.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Common\CommonClass.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\BottomControls\BottomDateSelectControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\BottomControls\BottomMenuSelectControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\BottomControls\BottomSomeDaySelectControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\TextInputControls\TextInputDialog.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Form\AppGestureSecurityForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Form\AppNumPasswordSecurityForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlBluetoothAndroidLogic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlBluetoothIOSLogic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlCheckLogic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Logic\HdlCommonLogic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockAlwaysOnManagerPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockAlwaysOnListPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockExpireTimeSettionPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockHistoryInfoPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockHistoryTypeScreenPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockListPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockSelectTimePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\DoorLock\DoorLockUnlockMethordManagerPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\UserPageBLL.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\UserPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\ClassificationPage.cs" />
|
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | #region ■ 常开自动化信息_____________________ |
| | | |
| | | /// <summary> |
| | | /// 常开自动化信息 |
| | | /// </summary> |
| | | public class AlwayOnAutomationInfo |
| | | { |
| | | /// <summary> |
| | | /// 常开模式开启的 时 |
| | | /// </summary> |
| | | public int Hour = 9; |
| | | /// <summary> |
| | | /// 常开模式开启的 分 |
| | | /// </summary> |
| | | public int Minute = 0; |
| | | /// <summary> |
| | | /// 是否是打开常开模式 |
| | | /// </summary> |
| | | public bool IsOpenAlwayOn = true; |
| | | /// <summary> |
| | | /// 循环方式 1:执行一次 2:每天 3:每周 4:每月 |
| | | /// </summary> |
| | | public int LoopDiv = 1; |
| | | /// <summary> |
| | | /// 当 LoopDiv = 3时,它的值是 星期1-7 LoopDiv = 4时,它的值是 日期1-31 |
| | | /// </summary> |
| | | public List<int> ListLoopValue = new List<int>(); |
| | | /// <summary> |
| | | /// 推送配置 |
| | | /// </summary> |
| | | public UI.UI2.Intelligence.Automation.PushConfigs PushSettion = new UI.UI2.Intelligence.Automation.PushConfigs(); |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 门锁常开模式信息___________________ |
| | | |
| | | /// <summary> |
| | | /// 门锁常开模式信息 |
| | | /// </summary> |
| | | public class DoorLockAlwayOnInfo |
| | | { |
| | | /// <summary> |
| | | /// 是否是常开 |
| | | /// </summary> |
| | | public bool IsAlwayOpen = false; |
| | | /// <summary> |
| | | /// 开始时间 |
| | | /// </summary> |
| | | public DateTime StartTime = DateTime.Now; |
| | | /// <summary> |
| | | /// 常开的时间(小时) |
| | | /// </summary> |
| | | public int AlwayOpenHour = 4; |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 门锁历史记录信息___________________ |
| | | |
| | | /// <summary> |
| | | /// 门锁历史记录信息 |
| | | /// </summary> |
| | | public class DoorHistoryLog |
| | | { |
| | | /// <summary> |
| | | /// 设备主键 |
| | | /// </summary> |
| | | public string Sid = string.Empty; |
| | | /// <summary> |
| | | /// 数据库主键 |
| | | /// </summary> |
| | | public string Id = string.Empty; |
| | | /// <summary> |
| | | /// 消息 |
| | | /// </summary> |
| | | public string StrMsg = string.Empty; |
| | | /// <summary> |
| | | /// 时间 |
| | | /// </summary> |
| | | public DateTime Time; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | |
| | | #region ■ 重写彪哥的属性_____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 重写Text属性
|
| | | /// 重写Text属性(文本中有{0}的话,会自动全部替换为换行符)
|
| | | /// </summary>
|
| | | public new string Text
|
| | | {
|
| | |
| | | get { return base.Text == null ? string.Empty : base.Text; }
|
| | | set
|
| | | {
|
| | | base.Text = value == null ? string.Empty : value;
|
| | | base.Text = value == null ? string.Empty : value.Replace("{0}", "\r\n");
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 背景色(重写底层属性)
|
| | | /// </summary>
|
| | | public new uint BackgroundColor
|
| | | {
|
| | | get { return base.BackgroundColor; }
|
| | | set
|
| | | {
|
| | | //只有不一样,才变更
|
| | | if (base.BackgroundColor != value)
|
| | | {
|
| | | base.BackgroundColor = value;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 字体颜色(重写底层属性)
|
| | | /// </summary>
|
| | | public new uint TextColor
|
| | | {
|
| | | get { return base.TextColor; }
|
| | | set
|
| | | {
|
| | | //只有不一样,才变更
|
| | | if (base.TextColor != value)
|
| | | {
|
| | | base.TextColor = value;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
| | | i_Height = Application.GetRealHeight(i_Height);
|
| | | }
|
| | | this.Height = i_Height;
|
| | | this.Width = i_Width;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化控件大小(不以平均值进行真实数值计算)
|
| | | /// </summary>
|
| | | /// <param name="i_Width">宽度</param>
|
| | | /// <param name="real">是否计算真实值</param>
|
| | | public void InitSize(int i_Width, bool real = false)
|
| | | {
|
| | | if (real == true)
|
| | | {
|
| | | i_Width = Application.GetRealWidth(i_Width);
|
| | | }
|
| | | this.Width = i_Width;
|
| | | }
|
| | |
|
| | |
| | | /// <returns></returns>
|
| | | public int GetRealWidthByText()
|
| | | {
|
| | | if (string.IsNullOrEmpty(this.Text) == true) { return Application.GetRealWidth(25); }
|
| | | if (string.IsNullOrEmpty(this.Text) == true) { return Application.GetRealWidth(4); }
|
| | |
|
| | | return base.GetTextWidth();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 计算图片的真实高宽度
|
| | | /// </summary>
|
| | | /// <param name="i_size"></param>
|
| | | /// <returns></returns>
|
| | | public int GetPictrueRealSize(int i_size)
|
| | | {
|
| | | return Application.GetRealWidth(i_size);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | row++;
|
| | | }
|
| | | return row;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 计算图片的真实高宽度
|
| | | /// </summary>
|
| | | /// <param name="i_size"></param>
|
| | | /// <returns></returns>
|
| | | public int GetPictrueRealSize(int i_size)
|
| | | {
|
| | | return Application.GetRealWidth(i_size);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 输入框控件的最初原型(不建议修改和直接使用):标准字体颜色,文字向左靠齐,14号字
|
| | | /// 输入框控件的最初原型(不建议修改和直接使用):标准字体颜色(0xFF798394),文字向左靠齐,14号字
|
| | | /// </summary>
|
| | | public TextInputBase()
|
| | | {
|
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | /// <summary> |
| | | /// 底部日期选择控件(年月日),不需要加到父控件 |
| | | /// </summary> |
| | | public class BottomDateSelectControl : BottomDialogCommon |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 结束事件(0:点击了取消 1:点击了确定,第二,三,四参数为年月日) |
| | | /// </summary> |
| | | public Action<int, int, int, int> FinishEvent = null; |
| | | /// <summary> |
| | | /// 年的集合 |
| | | /// </summary> |
| | | private List<string> listYear = new List<string>(); |
| | | /// <summary> |
| | | /// 月的集合 |
| | | /// </summary> |
| | | private List<string> listMonth = new List<string>(); |
| | | /// <summary> |
| | | /// 日的集合 |
| | | /// </summary> |
| | | private List<string> listDay = new List<string>(); |
| | | /// <summary> |
| | | /// 选择的年 |
| | | /// </summary> |
| | | private int selectYear = 0; |
| | | /// <summary> |
| | | /// 选择的月 |
| | | /// </summary> |
| | | private int selectMonth = 0; |
| | | /// <summary> |
| | | /// 选择的日 |
| | | /// </summary> |
| | | private int selectDay = 0; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 底部时间选择控件(年月日),不需要加到父控件 |
| | | /// </summary> |
| | | /// <param name="i_title">标题</param> |
| | | /// <param name="clickBackClose">点击背景时,是否关闭弹窗</param> |
| | | public BottomDateSelectControl(string i_title = "", bool clickBackClose = true) |
| | | { |
| | | base.ClickBackClose = clickBackClose; |
| | | base.StrTitle = i_title; |
| | | base.RowCount = 5; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件(月日) |
| | | /// </summary> |
| | | /// <param name="i_month">默认选择月</param> |
| | | /// <param name="i_day">默认选择日</param> |
| | | public void InitControl(int i_month, int i_day) |
| | | { |
| | | //初始化控件 |
| | | this.DoInitControl(0, i_month, i_day, -1, -1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件(年月日) |
| | | /// </summary> |
| | | /// <param name="i_year">默认选择年</param> |
| | | /// <param name="i_month">默认选择月</param> |
| | | /// <param name="i_day">默认选择日</param> |
| | | /// <param name="i_yearFrom">年的范围指定,以当前年为基准,向前几年,请输入正数</param> |
| | | /// <param name="i_yearTo">年的范围指定,以当前年为基准,向后几年,请输入正数</param> |
| | | public void InitControl(int i_year, int i_month, int i_day, int i_yearFrom, int i_yearTo) |
| | | { |
| | | //初始化控件 |
| | | this.DoInitControl(i_year, i_month, i_day, i_yearFrom, i_yearTo); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件 |
| | | /// </summary> |
| | | /// <param name="i_year">默认选择年</param> |
| | | /// <param name="i_month">默认选择月</param> |
| | | /// <param name="i_day">默认选择日</param> |
| | | /// <param name="i_yearFrom">年的范围指定,以当前年为基准,向前几年,请输入正数</param> |
| | | /// <param name="i_yearTo">年的范围指定,以当前年为基准,向后几年,请输入正数</param> |
| | | private void DoInitControl(int i_year, int i_month, int i_day, int i_yearFrom, int i_yearTo) |
| | | { |
| | | //已经初始化 |
| | | if (base.btnCancel != null) { return; } |
| | | |
| | | this.selectYear = i_year; |
| | | this.selectMonth = i_month; |
| | | this.selectDay = i_day; |
| | | |
| | | //初始化年月日列表 |
| | | this.InitYearMonthDayList(i_yearFrom, i_yearTo); |
| | | |
| | | //初始化底层控件 |
| | | var frameWhiteBack = base.InitBaseControl(); |
| | | //取消 |
| | | base.btnCancel.ButtonClickEvent += (sender, e) => |
| | | { |
| | | base.Close(); |
| | | this.FinishEvent?.Invoke(0, 0, 0, 0); |
| | | this.FinishEvent = null; |
| | | }; |
| | | //确认 |
| | | base.btnConfirm.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //检测选择的年月日是否正确 |
| | | if (HdlCommonLogic.Current.CheckDateIsRight(selectYear, selectMonth, selectDay) == false) |
| | | { |
| | | return; |
| | | } |
| | | base.Close(); |
| | | this.FinishEvent?.Invoke(1, selectYear, selectMonth, selectDay); |
| | | this.FinishEvent = null; |
| | | }; |
| | | |
| | | //线 |
| | | var btnLine = new NormalViewControl(frameWhiteBack.Width, HdlControlResourse.BottomLineHeight, false); |
| | | btnLine.BackgroundColor = CSS_Color.PromptingColor2; |
| | | btnLine.Y = btnCancel.Bottom; |
| | | frameWhiteBack.AddChidren(btnLine); |
| | | |
| | | //时间控件 |
| | | var pickerView = new UIPickerView(); |
| | | pickerView.Height = frameWhiteBack.Height - btnLine.Bottom; |
| | | pickerView.Width = frameWhiteBack.Width - Application.GetRealWidth(8) * 2; |
| | | pickerView.Y = btnLine.Bottom; |
| | | pickerView.Gravity = Gravity.CenterHorizontal; |
| | | frameWhiteBack.AddChidren(pickerView); |
| | | |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | //初始化控件(中文) |
| | | this.DoInitControlOnChineseLanguage(pickerView, i_year, i_month, i_day); |
| | | } |
| | | else |
| | | { |
| | | //初始化控件(英文) |
| | | this.DoInitControlOnEnglishLanguage(pickerView, i_year, i_month, i_day); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件(中文) |
| | | /// </summary> |
| | | /// <param name="pickerView">时间控件</param> |
| | | /// <param name="i_year">默认选择年</param> |
| | | /// <param name="i_month">默认选择月</param> |
| | | /// <param name="i_day">默认选择日</param> |
| | | private void DoInitControlOnChineseLanguage(UIPickerView pickerView, int i_year, int i_month, int i_day) |
| | | { |
| | | //默认索引 |
| | | var index1 = listYear.IndexOf(i_year.ToString() + Language.StringByID(StringId.Years)); |
| | | if (index1 == -1) { index1 = 0; } |
| | | var index2 = listMonth.IndexOf(i_month.ToString() + Language.StringByID(StringId.month)); |
| | | if (index2 == -1) { index2 = 0; } |
| | | var index3 = listDay.IndexOf(i_day.ToString() + Language.StringByID(StringId.day)); |
| | | if (index3 == -1) { index2 = 0; } |
| | | |
| | | pickerView.setNPicker(listYear.Count == 0 ? null : listYear, listMonth, listDay); |
| | | //设置初始选择 |
| | | pickerView.setCurrentItems(index1, index2, index3); |
| | | |
| | | pickerView.OnSelectChangeEvent = (value1, value2, value3) => |
| | | { |
| | | //更改索引 |
| | | selectYear = Convert.ToInt32(listYear[value1].Substring(0, 4)); |
| | | selectMonth = value2 + 1; |
| | | selectDay = value3 + 1; |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件(英文) |
| | | /// </summary> |
| | | /// <param name="pickerView">时间控件</param> |
| | | /// <param name="i_year">默认选择年</param> |
| | | /// <param name="i_month">默认选择月</param> |
| | | /// <param name="i_day">默认选择日</param> |
| | | private void DoInitControlOnEnglishLanguage(UIPickerView pickerView, int i_year, int i_month, int i_day) |
| | | { |
| | | //默认索引 |
| | | var index1 = listYear.IndexOf(i_year.ToString()); |
| | | if (index1 == -1) { index1 = 0; } |
| | | var index2 = i_month - 1; |
| | | var index3 = i_day - 1; |
| | | |
| | | pickerView.setNPicker(listYear.Count == 0 ? null : listDay, listMonth, listYear); |
| | | //设置初始选择 |
| | | pickerView.setCurrentItems(index3, index2, index1); |
| | | |
| | | pickerView.OnSelectChangeEvent = (value1, value2, value3) => |
| | | { |
| | | //更改索引 |
| | | selectYear = Convert.ToInt32(listYear[value3]); |
| | | selectMonth = value2 + 1; |
| | | selectDay = value1 + 1; |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化年月日列表 |
| | | /// </summary> |
| | | /// <param name="i_yearFrom">年的范围指定,以当前年为基准,向前几年,请输入正数</param> |
| | | /// <param name="i_yearTo">年的范围指定,以当前年为基准,向后几年,请输入正数</param> |
| | | private void InitYearMonthDayList(int i_yearFrom, int i_yearTo) |
| | | { |
| | | //年 |
| | | var strYear = Language.CurrentLanguage == "Chinese" ? Language.StringByID(StringId.Years) : string.Empty; |
| | | //月 |
| | | var strMonth = Language.StringByID(StringId.month); |
| | | //日 |
| | | var strDay = Language.CurrentLanguage == "Chinese" ? Language.StringByID(StringId.day) : string.Empty; |
| | | |
| | | //获取年的列表 |
| | | int nowYear = DateTime.Now.Year; |
| | | for (int i = i_yearFrom; i > 0; i--) |
| | | { |
| | | this.listYear.Add((nowYear - i) + strYear); |
| | | } |
| | | this.listYear.Add(nowYear + strYear); |
| | | for (int i = i_yearTo; i > 0; i--) |
| | | { |
| | | this.listYear.Add((nowYear + i) + strYear); |
| | | } |
| | | |
| | | //获取月的列表 |
| | | for (int i = 1; i <= 12; i++) |
| | | { |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | //中文 |
| | | this.listMonth.Add(i.ToString() + strMonth); |
| | | } |
| | | else |
| | | { |
| | | //英文 |
| | | this.listMonth.Add(HdlCommonLogic.Current.GetMonthShortText(i)); |
| | | } |
| | | } |
| | | |
| | | //获取日的列表 |
| | | for (int i = 1; i <= 31; i++) |
| | | { |
| | | this.listDay.Add(i.ToString() + strDay); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 关闭界面 |
| | | /// </summary> |
| | | public override void Close() |
| | | { |
| | | base.Close(); |
| | | this.FinishEvent = null; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | /// </summary>
|
| | | public bool ClickBackClose = true;
|
| | | /// <summary>
|
| | | /// 点击确认时关闭界面(有些界面特殊,不关闭)
|
| | | /// </summary>
|
| | | public bool ClickConfirmClose = true;
|
| | | /// <summary>
|
| | | /// 整个弹窗对象
|
| | | /// </summary>
|
| | | private Dialog FrameDialog = null;
|
| | |
| | | /// <summary>
|
| | | /// 初始化底层控件(返回的是四周有圆角的白色区域控件),此方法由封装控件底层调用,请勿随便调用
|
| | | /// </summary>
|
| | | public NormalFrameLayout InitBaseControl()
|
| | | /// <param name="i_whiteWidth">白色区域的宽度,最好不要改这个东西</param>
|
| | | /// <param name="real">是否计算真实值</param>
|
| | | /// <returns></returns>
|
| | | public NormalFrameLayout InitBaseControl(int i_whiteWidth = 343, bool real = true)
|
| | | {
|
| | | //整个灰色界面
|
| | | this.FrameDialog?.Close();
|
| | |
| | | }
|
| | | };
|
| | |
|
| | | //白色背景
|
| | | //标题高度
|
| | | int titleHeight = Application.GetRealHeight(50);
|
| | |
|
| | | //白色背景(样子悬浮于界面,四个角都是圆角)
|
| | | var frameWhiteBack = new NormalFrameLayout();
|
| | | frameWhiteBack.Width = Application.GetRealWidth(343);
|
| | | frameWhiteBack.Height = RowHeight * (RowCount + 1);
|
| | | frameWhiteBack.Width = real == true ? Application.GetRealWidth(i_whiteWidth) : i_whiteWidth;
|
| | | frameWhiteBack.Height = RowHeight * RowCount + titleHeight;
|
| | | frameWhiteBack.Radius = (uint)Application.GetRealWidth(12);
|
| | | frameWhiteBack.Gravity = Gravity.CenterHorizontal;
|
| | | frameWhiteBack.Y = dialogBody.Height - RowHeight * (RowCount + 1) - Application.GetRealHeight(20);
|
| | | //它的底部有个20的间距
|
| | | frameWhiteBack.Y = dialogBody.Height - RowHeight * RowCount - titleHeight - Application.GetRealHeight(20);
|
| | | frameWhiteBack.BackgroundColor = CSS_Color.MainBackgroundColor;
|
| | | dialogBody.AddChidren(frameWhiteBack);
|
| | |
|
| | |
| | | btnCancel.TextColor = CSS_Color.PromptingColor1;
|
| | | btnCancel.TextID = StringId.Cancel;
|
| | | btnCancel.TextSize = CSS_FontSize.TextFontSize;
|
| | | btnCancel.Width = btnCancel.GetRealWidthByText();
|
| | | frameWhiteBack.AddChidren(btnCancel);
|
| | |
|
| | | //标题
|
| | |
| | |
|
| | | //确认
|
| | | this.btnConfirm = new NormalViewControl(90, 48, true);
|
| | | btnConfirm.X = frameWhiteBack.Width - Application.GetRealWidth(90) - btnCancel.X;
|
| | | btnConfirm.Y = btnCancel.Y;
|
| | | btnConfirm.TextAlignment = TextAlignment.CenterRight;
|
| | | btnConfirm.TextColor = CSS_Color.MainColor;
|
| | | btnConfirm.TextID = StringId.Confirm;
|
| | | btnConfirm.TextSize = CSS_FontSize.TextFontSize;
|
| | | btnConfirm.Width = btnConfirm.GetRealWidthByText();
|
| | | frameWhiteBack.AddChidren(btnConfirm);
|
| | | btnConfirm.X = frameWhiteBack.Width - btnConfirm.Width - btnCancel.X;
|
| | |
|
| | | FrameDialog.Show();
|
| | |
|
| | |
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 底部项目编辑控件
|
| | | /// 底部项目编辑控件(不需要加入父控件,AddRowMenu添加菜单)
|
| | | /// </summary>
|
| | | public class BottomItemEditorControl : BottomDialogCommon
|
| | | {
|
| | |
| | | /// </summary>
|
| | | public Action<int> FinishEvent = null;
|
| | | /// <summary>
|
| | | /// 点击确认时,是否关闭界面(当设置为false时,只能手动关闭)
|
| | | /// </summary>
|
| | | public bool CloseByConfirm = true;
|
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalListControl listView = null;
|
| | |
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 有标题的弹窗型菜单编辑控件
|
| | | /// 有标题的弹窗型菜单编辑控件(不需要加入父控件,AddRowMenu添加菜单)
|
| | | /// </summary>
|
| | | /// <param name="i_RowCount">菜单行数(不含标题)</param>
|
| | | /// <param name="i_title">标题</param>
|
| | |
| | | //取消
|
| | | base.btnCancel.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | base.Close();
|
| | | this.FinishEvent?.Invoke(0);
|
| | | this.FinishEvent = null;
|
| | | this.Close();
|
| | | };
|
| | |
|
| | | //确认
|
| | | base.btnConfirm.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | base.Close();
|
| | | this.FinishEvent?.Invoke(1);
|
| | | this.FinishEvent = null;
|
| | | if (this.CloseByConfirm == true)
|
| | | {
|
| | | this.Close();
|
| | | }
|
| | | };
|
| | |
|
| | | //列表控件
|
| | |
| | | /// </summary>
|
| | | /// <param name="i_textView">左边显示的文字</param>
|
| | | /// <param name="i_textValue">右边显示的值(</param>
|
| | | /// <param name="clickEvent">单击菜单执行的事件(参数为右边显示值的那个控件)</param>
|
| | | public void AddRowMenu(string i_textView, string i_textValue, Action<NormalViewControl> clickEvent)
|
| | | /// <param name="clickEvent">单击菜单执行的事件(参数1:左边标题控件,参数2:右边显示值的那个控件)</param>
|
| | | /// <param name="addRightArrow">是否添加右箭头</param>
|
| | | public void AddRowMenu(string i_textView, string i_textValue, Action<NormalViewControl, NormalViewControl> clickEvent, bool addRightArrow = true)
|
| | | {
|
| | | //先初始化控件
|
| | | this.InitControl();
|
| | |
| | | //行
|
| | | var rowContr = new FrameRowControl();
|
| | | rowContr.LeftOffset = Application.GetRealWidth(20) - HdlControlResourse.XXLeft;
|
| | | rowContr.RightOffset = - rowContr.LeftOffset;
|
| | | rowContr.RightOffset = -rowContr.LeftOffset;
|
| | | rowContr.Width = this.listView.Width;
|
| | | rowContr.Height = this.RowHeight;
|
| | | this.listView.AddChidren(rowContr);
|
| | | //显示文本
|
| | | var btnView = rowContr.AddLeftCaption(i_textView, 150);
|
| | | var btnView = rowContr.AddLeftCaption(i_textView, 300);
|
| | | btnView.Width = btnView.GetRealWidthByText();
|
| | | btnView.TextColor = CSS_Color.FirstLevelTitleColor;
|
| | | //添加右箭头
|
| | | rowContr.AddRightArrow();
|
| | | if (addRightArrow == true)
|
| | | {
|
| | | rowContr.AddRightArrow();
|
| | | }
|
| | | //添加右边的文本
|
| | | var btnValue = rowContr.AddMostRightView(i_textValue, 150);
|
| | | var btnValue = rowContr.AddMostRightView(i_textValue, 200);
|
| | | rowContr.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | clickEvent?.Invoke(btnValue);
|
| | | clickEvent?.Invoke(btnView, btnValue);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 底部项目选择控件
|
| | | /// 底部项目选择控件(不需要加入父控件,AddRowMenu添加菜单)
|
| | | /// </summary>
|
| | | public class BottomItemSelectControl: BottomDialogCommon
|
| | | {
|
| | |
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 有标题的弹窗型菜单选择控件
|
| | | /// 有标题的弹窗型菜单选择控件(不需要加入父控件,AddRowMenu添加菜单)
|
| | | /// </summary>
|
| | | /// <param name="i_RowCount">菜单行数(不含标题)</param>
|
| | | /// <param name="i_title">标题</param>
|
| | |
| | | rowContr.Height = this.RowHeight;
|
| | | this.listView.AddChidren(rowContr);
|
| | | //显示文本
|
| | | var btnView = rowContr.AddLeftCaption(i_text, 150);
|
| | | var btnView = rowContr.AddLeftCaption(i_text, 300);
|
| | | btnView.TextColor = CSS_Color.FirstLevelTitleColor;
|
| | | //选择图标
|
| | | var btnIcon = rowContr.AddMostRightEmptyIcon(28, 28);
|
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | /// <summary> |
| | | /// 底部弹窗的菜单选择控件(不需要加入父控件,AddMenu添加菜单) |
| | | /// </summary> |
| | | public class BottomMenuSelectControl |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 菜单高度 |
| | | /// </summary> |
| | | private int menuHeight = Application.GetRealHeight(44); |
| | | /// <summary> |
| | | /// 菜单桌布控件 |
| | | /// </summary> |
| | | private FrameLayout frameMenuTable = null; |
| | | /// <summary> |
| | | /// 整个弹窗对象 |
| | | /// </summary> |
| | | private Dialog FrameDialog = null; |
| | | /// <summary> |
| | | /// 点击背景时,是否关闭弹窗 |
| | | /// </summary> |
| | | public bool ClickBackClose = true; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 底部弹窗的菜单选择控件(不需要加入父控件,AddMenu添加菜单) |
| | | /// </summary> |
| | | /// <param name="i_menuCount">菜单总数(不含取消菜单)</param> |
| | | public BottomMenuSelectControl(int i_menuCount) |
| | | { |
| | | //初始化控件 |
| | | this.InitControl(i_menuCount); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件 |
| | | /// </summary> |
| | | /// <param name="menuCount">菜单总数(不含取消菜单)</param> |
| | | private void InitControl(int menuCount) |
| | | { |
| | | //整个灰色界面 |
| | | this.FrameDialog = new Dialog(); |
| | | FrameDialog.Show(); |
| | | |
| | | var dialogBody = new NormalFrameLayout(); |
| | | dialogBody.Height = FrameDialog.Height; |
| | | FrameDialog.AddChidren(dialogBody); |
| | | dialogBody.ButtonClickEvent += (sender, e) => |
| | | { |
| | | if (ClickBackClose == true) |
| | | { |
| | | FrameDialog.Close(); |
| | | } |
| | | }; |
| | | |
| | | //取消菜单 |
| | | var frameCancel = new FrameLayout(); |
| | | frameCancel.Y = dialogBody.Height - this.menuHeight - Application.GetRealHeight(12); |
| | | frameCancel.Gravity = Gravity.CenterHorizontal; |
| | | frameCancel.Radius = (uint)Application.GetRealHeight(12); |
| | | frameCancel.Width = Application.GetRealWidth(343); |
| | | frameCancel.Height = this.menuHeight; |
| | | frameCancel.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | FrameDialog.AddChidren(frameCancel); |
| | | var btnCancel = new NormalViewControl(Application.GetRealWidth(150), this.menuHeight, false); |
| | | btnCancel.Gravity = Gravity.Center; |
| | | btnCancel.TextAlignment = TextAlignment.Center; |
| | | btnCancel.TextColor = CSS_Color.AuxiliaryColor2; |
| | | btnCancel.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnCancel.TextID = StringId.Cancel; |
| | | frameCancel.AddChidren(btnCancel); |
| | | btnCancel.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //关闭界面 |
| | | FrameDialog.Close(); |
| | | }; |
| | | |
| | | //菜单的桌布控件 |
| | | int framebackHeight = this.menuHeight * menuCount; |
| | | this.frameMenuTable = new FrameLayout(); |
| | | frameMenuTable.Y = frameCancel.Y - framebackHeight - Application.GetRealHeight(8); |
| | | frameMenuTable.Height = framebackHeight; |
| | | frameMenuTable.Width = Application.GetRealWidth(343); |
| | | frameMenuTable.Gravity = Gravity.CenterHorizontal; |
| | | frameMenuTable.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | frameMenuTable.Radius = (uint)Application.GetRealWidth(12); |
| | | FrameDialog.AddChidren(frameMenuTable); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 添加菜单 |
| | | /// </summary> |
| | | /// <param name="strMenu">菜单文本</param> |
| | | /// <param name="selectEvent">菜单选择的事件</param> |
| | | /// <param name="textColor">文本颜色(设置为0,则使用默认的蓝色字体)</param> |
| | | /// <param name="clickClose">菜单点击时,是否无条件关闭界面</param> |
| | | public void AddMenu(string strMenu, Action selectEvent, uint textColor = 0, bool clickClose = true) |
| | | { |
| | | //线 |
| | | if (this.frameMenuTable.ChildrenCount > 0) |
| | | { |
| | | var btnLine = new NormalViewControl(frameMenuTable.Width, HdlControlResourse.BottomLineHeight, false); |
| | | btnLine.BackgroundColor = CSS_Color.DividingLineColor; |
| | | btnLine.Y = this.frameMenuTable.GetChildren(this.frameMenuTable.ChildrenCount - 1).Bottom; |
| | | this.frameMenuTable.AddChidren(btnLine); |
| | | } |
| | | |
| | | //菜单 |
| | | var btnMenu = new NormalViewControl(Application.GetRealWidth(300), this.menuHeight, false); |
| | | if (this.frameMenuTable.ChildrenCount > 0) |
| | | { |
| | | btnMenu.Y = this.frameMenuTable.GetChildren(this.frameMenuTable.ChildrenCount - 1).Bottom; |
| | | } |
| | | btnMenu.Gravity = Gravity.CenterHorizontal; |
| | | btnMenu.TextAlignment = TextAlignment.Center; |
| | | btnMenu.TextColor = textColor == 0 ? CSS_Color.MainColor : textColor; |
| | | btnMenu.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnMenu.Text = strMenu; |
| | | this.frameMenuTable.AddChidren(btnMenu); |
| | | btnMenu.ButtonClickEvent += (sender, e) => |
| | | { |
| | | if (clickClose == true) |
| | | { |
| | | //关闭界面 |
| | | FrameDialog.Close(); |
| | | } |
| | | selectEvent?.Invoke(); |
| | | selectEvent = null; |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | /// <summary> |
| | | /// 底部选择一个月内的一些日期的控件,不需要加到父控件,InitControl执行初始化 |
| | | /// </summary> |
| | | public class BottomSomeDaySelectControl : BottomDialogCommon |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 结束事件(0:点击了取消 1:点击了确定,参数是选择的日) |
| | | /// </summary> |
| | | public Action<int, List<int>> FinishEvent = null; |
| | | /// <summary> |
| | | /// 目前选择的日期 |
| | | /// </summary> |
| | | private List<int> listSelectDay = new List<int>(); |
| | | /// <summary> |
| | | /// 目标月份 |
| | | /// </summary> |
| | | private int targetMonth = 0; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 底部选择一个月内的一些日期的控件,不需要加到父控件,InitControl执行初始化 |
| | | /// </summary> |
| | | /// <param name="i_title">标题</param> |
| | | /// <param name="clickBackClose">点击背景时,是否关闭弹窗</param> |
| | | /// <param name="i_month">显示执行月的日期,设置为0时,默认显示31天</param> |
| | | public BottomSomeDaySelectControl(string i_title = "", bool clickBackClose = true, int i_month = 0) |
| | | { |
| | | base.ClickBackClose = clickBackClose; |
| | | base.StrTitle = i_title; |
| | | base.RowCount = 5; |
| | | this.targetMonth = i_month; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件 |
| | | /// </summary> |
| | | /// <param name="listSelect">默认选择(日)</param> |
| | | public void InitControl(List<int> listSelect) |
| | | { |
| | | //已经初始化 |
| | | if (base.btnCancel != null) { return; } |
| | | |
| | | this.listSelectDay.AddRange(listSelect); |
| | | //初始化底层控件 |
| | | var frameWhiteBack = base.InitBaseControl(); |
| | | |
| | | //取消 |
| | | base.btnCancel.ButtonClickEvent += (sender, e) => |
| | | { |
| | | base.Close(); |
| | | this.FinishEvent?.Invoke(0, null); |
| | | this.FinishEvent = null; |
| | | }; |
| | | //确认 |
| | | base.btnConfirm.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //有选择了才能点确认 |
| | | if (this.listSelectDay.Count>0) |
| | | { |
| | | base.Close(); |
| | | |
| | | //小的在前,大的在后 |
| | | var listDay = new List<int>(); |
| | | for (int i = 1; i <= 31; i++) |
| | | { |
| | | if (listSelectDay.Contains(i) == false) { continue; } |
| | | listDay.Add(i); |
| | | } |
| | | this.FinishEvent?.Invoke(1, listDay); |
| | | this.FinishEvent = null; |
| | | } |
| | | }; |
| | | //初始化日期列表控件 |
| | | this.InitDayListControl(frameWhiteBack); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化日期列表控件 |
| | | /// </summary> |
| | | private void InitDayListControl(NormalFrameLayout frameWhiteBack) |
| | | { |
| | | //获取显示的天数 |
| | | var dayCount = this.GetDayCount(); |
| | | //初始X轴16 |
| | | int xxValue = Application.GetRealWidth(16); |
| | | //初始Y轴58 |
| | | int yyValue = Application.GetRealHeight(68); |
| | | for (int i = 1; i <= dayCount; i++) |
| | | { |
| | | int intDay = i; |
| | | var btnContr = new NormalViewControl(Application.GetRealWidth(30), Application.GetRealWidth(30), false); |
| | | btnContr.X = xxValue; |
| | | btnContr.Y = yyValue; |
| | | btnContr.Radius = (uint)Application.GetRealWidth(15); |
| | | btnContr.Text = intDay.ToString(); |
| | | btnContr.TextAlignment = TextAlignment.Center; |
| | | btnContr.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnContr.SelectedTextColor = CSS_Color.MainBackgroundColor; |
| | | btnContr.SelectedBackgroundColor = CSS_Color.MainColor; |
| | | btnContr.BackgroundColor = CSS_Color.viewTranslucence; |
| | | frameWhiteBack.AddChidren(btnContr); |
| | | |
| | | //换到下一行(每7个一行) |
| | | if (i % 7 == 0) |
| | | { |
| | | xxValue = Application.GetRealWidth(16); |
| | | //上下间距为10 |
| | | yyValue = btnContr.Bottom + Application.GetRealHeight(10); |
| | | } |
| | | else |
| | | { |
| | | //左右间距为16 |
| | | xxValue = btnContr.Right + Application.GetRealWidth(16); |
| | | } |
| | | btnContr.ButtonClickEvent += (sender, e) => |
| | | { |
| | | btnContr.IsSelected = !btnContr.IsSelected; |
| | | if (btnContr.IsSelected == true) |
| | | { |
| | | //添加缓存 |
| | | this.listSelectDay.Add(intDay); |
| | | } |
| | | else |
| | | { |
| | | //移除缓存 |
| | | this.listSelectDay.Remove(intDay); |
| | | } |
| | | }; |
| | | //是否初始选择 |
| | | btnContr.IsSelected = this.listSelectDay.Contains(intDay); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 获取天数 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private int GetDayCount() |
| | | { |
| | | if (this.targetMonth < 1 || this.targetMonth > 12) { return 31; } |
| | | |
| | | int two = DateTime.IsLeapYear(DateTime.Now.Year) == true ? 29 : 28; |
| | | int[] arry = new int[] { 31, two, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
| | | |
| | | return arry[this.targetMonth - 1]; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 关闭界面 |
| | | /// </summary> |
| | | public override void Close() |
| | | { |
| | | base.Close(); |
| | | this.FinishEvent = null; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 底部时间选择控件
|
| | | /// 底部时间选择控件(时和分),不需要加到父控件
|
| | | /// </summary>
|
| | | public class BottomTimeSelectControl : BottomDialogCommon
|
| | | {
|
| | |
| | | int selectHour = 0; |
| | | int selectMinute = 0; |
| | | //XX时 |
| | | List<string> listHour ; |
| | | List<string> listHour; |
| | | //XX分 |
| | | List<string> listMinute;
|
| | |
|
| | |
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 底部时间选择控件
|
| | | /// 底部时间选择控件(时和分),不需要加到父控件
|
| | | /// </summary>
|
| | | /// <param name="i_title">标题</param>
|
| | | /// <param name="clickBackClose">点击背景时,是否关闭弹窗</param>
|
| | | public BottomTimeSelectControl(string i_title = "", bool clickBackClose = true)
|
| | | {
|
| | | base.ClickBackClose = clickBackClose;
|
| | | base.StrTitle = i_title; |
| | | |
| | | base.StrTitle = i_title;
|
| | | base.RowCount = 5; |
| | | |
| | | for (int i = 0; i <= 23; i++)
|
| | | {
|
| | |
| | | |
| | | |
| | | /// <summary>
|
| | | /// 底部时间选择控件
|
| | | /// 底部时间选择控件(时和分),不需要加到父控件
|
| | | /// </summary>
|
| | | /// <param name="i_title">标题</param>
|
| | | /// <param name="clickBackClose">点击背景时,是否关闭弹窗</param>
|
| | | public BottomTimeSelectControl(List<int> hoursRange,List<int> minuteRange ,int rowCount, string i_title = "", bool clickBackClose = true)
|
| | | public BottomTimeSelectControl(List<int> hoursRange, List<int> minuteRange, int rowCount, string i_title = "", bool clickBackClose = true)
|
| | | {
|
| | | base.ClickBackClose = clickBackClose;
|
| | | base.StrTitle = i_title;
|
| | |
| | | /// <param name="i_hour">默认选择时</param>
|
| | | /// <param name="i_minute">默认选择分</param>
|
| | | /// <param name="contentView">选择区域高度</param>
|
| | | public void InitControl(int i_hour, int i_minute,int contentView = 297)
|
| | | public void InitControl(int i_hour, int i_minute, int contentView = 297)
|
| | | {
|
| | | //已经初始化
|
| | | if (base.btnCancel != null) { return; }
|
| | |
|
| | | this.selectHour = i_hour;
|
| | | this.selectMinute = i_minute;
|
| | |
|
| | | //初始化底层控件
|
| | | var frameWhiteBack = base.InitBaseControl();
|
| | | frameWhiteBack.Height = Application.GetRealHeight(contentView);
|
| | | if (contentView != -1)
|
| | | {
|
| | | frameWhiteBack.Height = Application.GetRealHeight(contentView);
|
| | | }
|
| | | //frameWhiteBack.Y = frameWhiteBack.Parent.Height - Application.GetRealHeight(297 + 20);
|
| | |
|
| | | //取消
|
| | |
| | | //时间控件
|
| | | pickerView = new UIPickerView();
|
| | | //时
|
| | | var strhour = Language.StringByID(StringId.h);
|
| | | var strhour = HdlCommonLogic.Current.GetHourText();
|
| | | //分
|
| | | var strMinute = Language.StringByID(StringId.m);
|
| | | var strMinute = HdlCommonLogic.Current.GetMinuteText();
|
| | | //XX时
|
| | | listHour = new List<string>();// { "00" + strhour };
|
| | | //XX分
|
| | | listMinute = new List<string>();// { "00" + strMinute }; |
| | | //for (int i = 1; i <= 23; i++) |
| | | foreach(var hItem in hRange) |
| | | foreach (var hItem in hRange) |
| | | {
|
| | | listHour.Add(hItem.ToString().PadLeft(2, '0') + strhour);
|
| | | } |
| | |
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 电池百分比控件
|
| | | /// 电池百分比控件(高为25)
|
| | | /// </summary>
|
| | | public class BatteryPersentControl : NormalFrameLayout
|
| | | {
|
| | |
| | | /// 进度条
|
| | | /// </summary>
|
| | | private NormalViewControl btnProgress = null;
|
| | | /// <summary>
|
| | | /// 图标控件
|
| | | /// </summary>
|
| | | private IconViewControl btnIcon = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 电池百分比控件
|
| | | /// 电池百分比控件(高为25)
|
| | | /// </summary>
|
| | | public BatteryPersentControl()
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | public void InitControl()
|
| | | /// <param name="showPersent">是否在右边显示百分比</param>
|
| | | public void InitControl(bool showPersent = true)
|
| | | {
|
| | | var btnIcon = new IconViewControl(24);
|
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Battery.png";
|
| | | this.btnIcon = new IconViewControl(24);
|
| | | btnIcon.UnSelectedImagePath = "Public/BatteryEnough.png";
|
| | | this.AddChidren(btnIcon);
|
| | |
|
| | | //电池百分比
|
| | | this.btnBatteryView = new NormalViewControl(30, 16, true);
|
| | | btnBatteryView.X = btnIcon.Right + Application.GetRealWidth(4);
|
| | | btnBatteryView.Y = btnIcon.Y + (btnIcon.Height - Application.GetRealHeight(16)) / 2;
|
| | | btnBatteryView.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel;
|
| | | btnBatteryView.TextColor = CSS_Color.PromptingColor1;
|
| | | this.AddChidren(btnBatteryView);
|
| | | if (showPersent == true)
|
| | | {
|
| | | this.btnBatteryView = new NormalViewControl(30, 16, true);
|
| | | btnBatteryView.X = btnIcon.Right + Application.GetRealWidth(4);
|
| | | btnBatteryView.Y = btnIcon.Y + (btnIcon.Height - Application.GetRealHeight(16)) / 2;
|
| | | btnBatteryView.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel;
|
| | | btnBatteryView.TextColor = CSS_Color.PromptingColor1;
|
| | | this.AddChidren(btnBatteryView);
|
| | | }
|
| | |
|
| | | //进度条控件
|
| | | this.btnProgress = new NormalViewControl(this.GetPictrueRealSize(15), this.GetPictrueRealSize(8), false);
|
| | |
| | | public void SetValue(decimal i_value)
|
| | | {
|
| | | int myWidth = (int)((i_value / 100) * this.GetPictrueRealSize(15));
|
| | | this.btnBatteryView.Text = i_value + "%";
|
| | | if (this.btnBatteryView != null)
|
| | | {
|
| | | this.btnBatteryView.Text = i_value + "%";
|
| | | }
|
| | |
|
| | | this.btnProgress.Width = myWidth;
|
| | | if (i_value <= 20)
|
| | | {
|
| | | if (this.btnProgress.BackgroundColor == CSS_Color.PromptingColor1)
|
| | | {
|
| | | //变红色
|
| | | this.btnProgress.BackgroundColor = 0xfff62f48;
|
| | | }
|
| | | //变红色
|
| | | this.btnProgress.BackgroundColor = 0xfff62f48;
|
| | | this.btnIcon.UnSelectedImagePath = "Public/BatteryNot.png";
|
| | | }
|
| | | else
|
| | | {
|
| | | if (this.btnProgress.BackgroundColor == 0xfff62f48)
|
| | | {
|
| | | //变红色
|
| | | this.btnProgress.BackgroundColor = CSS_Color.PromptingColor1;
|
| | | }
|
| | | //变灰色
|
| | | this.btnProgress.BackgroundColor = CSS_Color.PromptingColor1;
|
| | | this.btnIcon.UnSelectedImagePath = "Public/BatteryEnough.png";
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 左右滑动的进度条控件
|
| | | /// <para>左右滑动的进度条控件(高度为54 左右间距为20)</para>
|
| | | /// <para>如果是加在PageLayout里面的话,加入父控件之后,请调用BindPageLayout()</para>
|
| | | /// </summary>
|
| | | public class SeekBarImageControl : DiyImageSeekBar
|
| | | {
|
| | |
| | | /// 上方显示的文本
|
| | | /// </summary>
|
| | | private Button btnTopView = null;
|
| | | /// <summary>
|
| | | /// 绑定PageLayout,事件冲突,需要特殊处理
|
| | | /// </summary>
|
| | | private PageLayout pageLayoutBind = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 左右滑动的进度条控件(高度为54 左右间距为20)
|
| | | /// <para>左右滑动的进度条控件(高度为54 左右间距为20)</para>
|
| | | /// <para>如果是加在PageLayout里面的话,加入父控件之后,请调用BindPageLayout()</para>
|
| | | /// </summary>
|
| | | /// <param name="i_width">宽度,非真实值,实际宽度会加上左右间距</param>
|
| | | public SeekBarImageControl(int i_width)
|
| | | {
|
| | | this.ProgressChangeDelayTime = 0;
|
| | |
|
| | | this.Width = Application.GetRealWidth(i_width) + Application.GetRealWidth(20) * 2;
|
| | | this.Width = Application.GetRealWidth(i_width) + m_SeekBarPadding * 2;
|
| | | this.Height = Application.GetRealHeight(54);
|
| | | //圆球的高度
|
| | | this.ThumbImageHeight = Application.GetRealHeight(54);
|
| | |
| | | this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent;
|
| | | return;
|
| | | }
|
| | | if (this.pageLayoutBind != null && this.pageLayoutBind.ScrollEnabled == false)
|
| | | {
|
| | | //事件冲突,特殊处理,让pageLayout还原滑动
|
| | | this.pageLayoutBind.ScrollEnabled = true;
|
| | | }
|
| | | //弹起事件不需要判断时间
|
| | | this.ProgressChangedEvent(1, value);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 手指开始点击事件
|
| | | /// </summary>
|
| | | /// <param name="sender"></param>
|
| | | /// <param name="value"></param>
|
| | | private void MyStartTrackingTouchEvent(object sender, bool value)
|
| | | {
|
| | | if (this.pageLayoutBind != null && this.pageLayoutBind.ScrollEnabled == true)
|
| | | {
|
| | | //事件冲突,特殊处理,让pageLayout不能滑动
|
| | | this.pageLayoutBind.ScrollEnabled = false;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 绑定PageLayout
|
| | | /// </summary>
|
| | | public void BindPageLayout()
|
| | | {
|
| | | //获取PageLayout
|
| | | this.pageLayoutBind = this.GetParentPageLayout();
|
| | | if (this.pageLayoutBind == null) { return; }
|
| | |
|
| | | this.OnStartTrackingTouchEvent -= this.MyStartTrackingTouchEvent;
|
| | | this.OnStartTrackingTouchEvent += this.MyStartTrackingTouchEvent;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取父控件的PageLayout
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private PageLayout GetParentPageLayout()
|
| | | {
|
| | | ViewGroup viewGroup = this.Parent;
|
| | | while (true)
|
| | | {
|
| | | if (viewGroup == null) { return null; }
|
| | | else if (viewGroup is PageLayout)
|
| | | {
|
| | | return (PageLayout)viewGroup;
|
| | | }
|
| | | viewGroup = viewGroup.Parent;
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 控件摧毁
|
| | | /// </summary>
|
| | | public override void RemoveFromParent()
|
| | | {
|
| | | this.pageLayoutBind = null;
|
| | | this.ProgressChangedEvent = null;
|
| | |
|
| | | base.RemoveFromParent();
|
| | | }
|
| | |
|
| | |
| | | button.ButtonClickEvent -= ChildrenUpEvent;
|
| | | button.ButtonClickEvent += ChildrenUpEvent;
|
| | | }
|
| | | else if (view is ImageView)
|
| | | else if (view is ImageView || view is Button)
|
| | | {
|
| | | //自身也添加事件
|
| | | //为子控件添加事件
|
| | | view.MouseUpEventHandler -= ChildrenUpEvent;
|
| | | view.MouseUpEventHandler += ChildrenUpEvent;
|
| | | }
|
| | |
| | | /// </summary>
|
| | | /// <param name="view">子控件</param>
|
| | | /// <param name="chidrenBindMode">绑定模式</param>
|
| | | public void AddChidren(View view, ChidrenBindMode chidrenBindMode = ChidrenBindMode.BindEvent)
|
| | | public void AddChidren(View view, ChidrenBindMode chidrenBindMode)
|
| | | {
|
| | | base.AddChidren(view);
|
| | |
|
| | |
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 做成一个RowLayout型的FrameLayout
|
| | | /// 做成一个RowLayout型的FrameLayout(底层的高度为44)
|
| | | /// </summary>
|
| | | public class FrameRowControl : FrameLayoutStatuControl
|
| | | {
|
| | |
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 做成一个RowLayout型的FrameLayout
|
| | | /// 做成一个RowLayout型的FrameLayout(底层的高度为44)
|
| | | /// </summary>
|
| | | /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param>
|
| | | public FrameRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
|
| | |
| | | //已经添加了底线
|
| | | return btnBottomLine;
|
| | | }
|
| | | int lineWidth = this.Width - HdlControlResourse.XXLeft * 2 - LeftOffset - RightOffset;
|
| | | int lineWidth = this.Width - HdlControlResourse.XXLeft * 2 - LeftOffset + RightOffset;
|
| | | int XX = HdlControlResourse.XXLeft + LeftOffset;
|
| | | if (leftIconSize > 0)
|
| | | {
|
| | |
| | | return btnBottomLine;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 手动移除底线(有些时候需要这种特殊效果)
|
| | | /// </summary>
|
| | | public void RemoveBottomLine()
|
| | | {
|
| | | for (int i = 0; i < this.ChildrenCount; i++)
|
| | | {
|
| | | var myView = this.GetChildren(i);
|
| | | //这里是底线的高度和Y轴
|
| | | if (myView == null || myView.Height != HdlControlResourse.BottomLineHeight
|
| | | || myView.Y != this.Height - HdlControlResourse.BottomLineHeight)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | //移除底线
|
| | | myView.RemoveFromParent();
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加左边Caption____________________
|
| | |
| | | this.buttonOkText = i_buttonOkText == null ? Language.StringByID(StringId.Confirm) : i_buttonOkText;
|
| | | this.buttonCancelText = i_buttonCancelText == null ? Language.StringByID(StringId.Cancel) : i_buttonCancelText;
|
| | | this.msgType = i_msgType;
|
| | | this.msgText = i_msg;
|
| | | this.msgText = i_msg.Replace("{0}", "\r\n");
|
| | | this.WaitTime = i_waitTime;
|
| | |
|
| | | if (i_msgType == ShowMsgType.Tip)
|
| | |
| | | myTip = null;
|
| | | return;
|
| | | }
|
| | | //初始化控件
|
| | | this.InitMsgControl();
|
| | | if (this.msgType == ShowMsgType.TipRemind || this.msgType == ShowMsgType.TipSuccess)
|
| | | {
|
| | | //初始化控件
|
| | | this.InitExTipControl();
|
| | | }
|
| | | else if (this.msgType == ShowMsgType.ConfirmSuccess || this.msgType == ShowMsgType.ConfirmFail)
|
| | | {
|
| | | //初始化控件
|
| | | this.InitConfirmSuccessTypeContorl();
|
| | | }
|
| | | else
|
| | | {
|
| | | //初始化控件
|
| | | this.InitMsgControl();
|
| | | }
|
| | | }
|
| | | catch { }
|
| | | }
|
| | |
| | | frameMain.AddChidren(frameCenter);
|
| | |
|
| | | //标题
|
| | | var btnTitle = new NormalViewControl(frameCenter.Width, Application.GetRealHeight(22), false);
|
| | | var btnTitle = new NormalViewControl(frameCenter.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(22), false);
|
| | | btnTitle.Y = Application.GetRealHeight(20);
|
| | | btnTitle.Gravity = Gravity.CenterHorizontal;
|
| | | btnTitle.TextColor = CSS_Color.MainColor;
|
| | | btnTitle.TextSize = CSS_FontSize.SubheadingFontSize;
|
| | | btnTitle.TextAlignment = TextAlignment.Center;
|
| | |
| | | this.StartWaitTime(btnConfirm);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化特殊的tip控件,仅支持 TipRemind 和 TipSuccess
|
| | | /// </summary>
|
| | | private void InitExTipControl()
|
| | | {
|
| | | //获取当前的界面
|
| | | var nowActionForm = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1) as ViewGroup;
|
| | | if (nowActionForm == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //主控件
|
| | | var frameMain = new NormalFrameLayout();
|
| | | frameMain.Height = nowActionForm.Height;
|
| | | frameMain.Width = nowActionForm.Width;
|
| | | nowActionForm.AddChidren(frameMain);
|
| | | frameMain.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | frameMain.RemoveFromParent();
|
| | | };
|
| | |
|
| | | //计算用
|
| | | var btnTemp = new ButtonCtrBase();
|
| | | btnTemp.Text = msgText.Replace("\r\n", string.Empty);
|
| | | //获取这个显示的内容的高度(蓝湖的黑色背景的宽度为198,然后再减去余白)
|
| | | int rowCount = btnTemp.GetRealRowCountByText(Application.GetRealWidth(198) - HdlControlResourse.XXLeft * 2);
|
| | | //再看看它原来按换行符分割为几行
|
| | | var myArry = msgText.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | //看看谁的行数多,就用谁的
|
| | | if (myArry.Length > rowCount)
|
| | | {
|
| | | rowCount = myArry.Length;
|
| | | }
|
| | | int contentHeight = rowCount * Application.GetRealHeight(20);
|
| | | //蓝湖黑色背景的Y轴为302
|
| | | var frameBlack = new FrameLayout();
|
| | | //如果是多行时,减掉一行的高度,则得出新增加的高度,然后再除以2,则为Y轴原始占比
|
| | | frameBlack.Y = Application.GetRealHeight(302) - (contentHeight - Application.GetRealHeight(20)) / 2;
|
| | | frameBlack.Width = Application.GetRealWidth(198);
|
| | | //实际计算出来的高度为 62+文本高度+16
|
| | | frameBlack.Height = Application.GetRealHeight(62) + contentHeight + Application.GetRealHeight(16);
|
| | | frameBlack.Radius = (uint)Application.GetRealWidth(12);
|
| | | frameBlack.Gravity = Gravity.CenterHorizontal;
|
| | | frameBlack.BackgroundColor = CSS_Color.DialogTransparentColor1;
|
| | | frameMain.AddChidren(frameBlack);
|
| | |
|
| | | //图标
|
| | | var btnIcon = new IconViewControl(42);
|
| | | btnIcon.Y = Application.GetRealHeight(10);
|
| | | btnIcon.Gravity = Gravity.CenterHorizontal;
|
| | | btnIcon.UnSelectedImagePath = this.msgType == ShowMsgType.TipSuccess ? "Public/MsgIcon/TipSuccessIcon.png" : "Public/MsgIcon/TipIconWhite.png";
|
| | | frameBlack.AddChidren(btnIcon);
|
| | |
|
| | | //显示文本
|
| | | var btnText = new NormalViewControl(frameBlack.Width - HdlControlResourse.XXLeft * 2, contentHeight, false);
|
| | | btnText.Y = btnIcon.Bottom + Application.GetRealHeight(10);
|
| | | btnText.TextAlignment = TextAlignment.Center;
|
| | | btnText.TextColor = CSS_Color.MainBackgroundColor;
|
| | | btnText.Gravity = Gravity.CenterHorizontal;
|
| | | btnText.IsMoreLines = true;
|
| | | btnText.Text = this.msgText;
|
| | | frameBlack.AddChidren(btnText);
|
| | |
|
| | | //开启关闭时间
|
| | | this.StartCloseTime(frameMain);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化确认成功型控件,仅支持 ConfirmSuccess 和 ConfirmFail
|
| | | /// </summary>
|
| | | private void InitConfirmSuccessTypeContorl()
|
| | | {
|
| | | var dialogForm = new Dialog();
|
| | | dialogForm.BackgroundColor = CSS_Color.DialogTransparentColor1;
|
| | | //主控件
|
| | | var frameMain = new NormalFrameLayout();
|
| | | dialogForm.AddChidren(frameMain);
|
| | | dialogForm.Show();
|
| | |
|
| | | //白色背景
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.Y = Application.GetRealHeight(223);
|
| | | frameBack.Gravity = Gravity.CenterHorizontal;
|
| | | frameBack.Width = Application.GetRealWidth(288);
|
| | | frameBack.Height = Application.GetRealHeight(245);
|
| | | frameBack.BackgroundColor = CSS_Color.MainBackgroundColor;
|
| | | frameBack.Radius = (uint)Application.GetRealWidth(12);
|
| | | frameMain.AddChidren(frameBack);
|
| | |
|
| | | //大图标(蓝湖上,它高出白色区域70像素,因为高宽的比率是不一样的,所以需要计算一下比率)
|
| | | decimal decProportion = 70m / 160;
|
| | | var btnIcon = new IconViewControl(160);
|
| | | btnIcon.Y = frameBack.Y - (int)(decProportion * btnIcon.IconSize);
|
| | | btnIcon.Gravity = Gravity.CenterHorizontal;
|
| | | btnIcon.UnSelectedImagePath = this.msgType == ShowMsgType.ConfirmSuccess ? "Public/Dialog/DialogTipTitleIcon_1.png" : "Public/Dialog/DialogTipTitleIcon_2.png";
|
| | | frameMain.AddChidren(btnIcon);
|
| | |
|
| | | //消息
|
| | | var btnMsg = new NormalViewControl(frameMain.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(50), false);
|
| | | //取大图标的下部高度,然后再加间距10
|
| | | btnMsg.Y = btnIcon.Height - (frameBack.Y - btnIcon.Y) + Application.GetRealHeight(10);
|
| | | btnMsg.Gravity = Gravity.CenterHorizontal;
|
| | | btnMsg.TextAlignment = TextAlignment.TopCenter;
|
| | | btnMsg.IsMoreLines = true;
|
| | | btnMsg.TextSize = CSS_FontSize.SubheadingFontSize;
|
| | | btnMsg.TextColor = CSS_Color.MainColor;
|
| | | btnMsg.Text = this.msgText;
|
| | | frameBack.AddChidren(btnMsg);
|
| | |
|
| | | //确认按钮
|
| | | var btnConfirm = new BottomClickButton(220);
|
| | | btnConfirm.Text = this.buttonOkText;
|
| | | btnConfirm.Y = Application.GetRealHeight(169);
|
| | | frameBack.AddChidren(btnConfirm);
|
| | | btnConfirm.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //关闭界面
|
| | | dialogForm.Close();
|
| | | //回调函数
|
| | | this.ConfirmClickEvent?.Invoke();
|
| | | this.ConfirmClickEvent = null;
|
| | | this.CancelClickEvent = null;
|
| | | };
|
| | |
|
| | | //开启等待时间
|
| | | this.StartWaitTime(btnConfirm);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 开启等待时间_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 开启等待时间(此函数只用于安卓)
|
| | | /// 开启等待时间
|
| | | /// </summary>
|
| | | /// <param name="btnConfirm">确认按钮</param>
|
| | | private void StartWaitTime(NormalViewControl btnConfirm)
|
| | | private void StartWaitTime(ButtonCtrBase btnConfirm)
|
| | | {
|
| | | if (this.WaitTime <= 0)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 开启等待时间
|
| | | /// 开启关闭时间
|
| | | /// </summary>
|
| | | /// <param name="btnConfirm">确认按钮</param>
|
| | | private void StartWaitTime(ButtonCtrBase btnConfirm)
|
| | | /// <param name="frameMain">主界面</param>
|
| | | private void StartCloseTime(FrameLayout frameMain)
|
| | | {
|
| | | if (this.WaitTime <= 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //不能点击
|
| | | btnConfirm.CanClick = false;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //显示剩余等待时间
|
| | | while (btnConfirm.Parent != null && this.WaitTime >= 0)
|
| | | while (frameMain.Parent != null && this.WaitTime >= 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnConfirm.Text = this.buttonOkText + "(" + this.WaitTime + ")";
|
| | | }, ShowErrorMode.NO);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | this.WaitTime--;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //可以点击
|
| | | btnConfirm.Text = this.buttonOkText;
|
| | | btnConfirm.CanClick = true;
|
| | | frameMain?.RemoveFromParent();
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | |
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 平凡普通的控件,基本只是用来显示✩
|
| | | /// 平凡普通的控件,基本只是用来显示✩(正常文本字体颜色(0xFF798394),文字向左靠齐)
|
| | | /// </summary>
|
| | | public class NormalViewControl : ButtonCtrBase
|
| | | {
|
| | |
| | | public NormalViewControl(int i_Width, int i_Height, bool real) |
| | | { |
| | | this.InitSize(i_Width, i_Height, real); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 平凡普通的控件,基本只是用来显示(正常文本字体颜色,文字向左靠齐),高度为标准高度 |
| | | /// </summary> |
| | | /// <param name="i_Width">宽度</param> |
| | | /// <param name="real">是否计算真实值</param> |
| | | public NormalViewControl(int i_Width, bool real) |
| | | { |
| | | this.InitSize(i_Width, real); |
| | | }
|
| | | }
|
| | | }
|
| | |
| | | namespace HDL_ON.Stan
|
| | | {
|
| | | /// <summary>
|
| | | /// 做成一个输入框控件
|
| | | /// 做成一个输入框控件,标准字体颜色(0xFF798394),文字向左靠齐,14号字
|
| | | /// </summary>
|
| | | public class TextInputControl : TextInputBase
|
| | | {
|
| | |
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary> |
| | | /// 做成一个输入框控件(正常文本字体颜色) |
| | | /// 做成一个输入框控件,标准字体颜色(0xFF798394),文字向左靠齐,14号字 |
| | | /// </summary> |
| | | /// <param name="i_Width">宽度</param> |
| | | /// <param name="i_Height">高度</param> |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using System; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | /// <summary> |
| | | /// 文本输入的弹窗界面(不用加入父控件) |
| | | /// </summary> |
| | | public class TextInputDialog |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 标题文本 |
| | | /// </summary> |
| | | private string titleText = string.Empty; |
| | | /// <summary> |
| | | /// 初始值 |
| | | /// </summary> |
| | | private string textValue = string.Empty; |
| | | /// <summary> |
| | | /// 当输入框为空白时的提示文本 |
| | | /// </summary> |
| | | private string emptyMsg = string.Empty; |
| | | /// <summary> |
| | | /// 确认按钮的文本 |
| | | /// </summary> |
| | | private string buttonOkText = string.Empty; |
| | | /// <summary> |
| | | /// 取消按钮的文本 |
| | | /// </summary> |
| | | private string buttonCancelText = string.Empty; |
| | | /// <summary> |
| | | /// 是否是密码输入 |
| | | /// </summary> |
| | | private bool isPassword = false; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 文本输入的弹窗界面(不用加入父控件) |
| | | /// </summary> |
| | | /// <param name="i_title">标题文本</param> |
| | | /// <param name="i_text">初始值</param> |
| | | /// <param name="i_emptyMsg">当输入框为空白时的提示文本</param> |
| | | /// <param name="i_buttonOkText">确认按钮的文本</param> |
| | | /// <param name="i_buttonCancelText">取消按钮的文本</param> |
| | | /// <param name="i_isPassword">是否是密码输入</param> |
| | | public TextInputDialog(string i_title, string i_text, string i_emptyMsg, string i_buttonOkText = null, string i_buttonCancelText = null, bool i_isPassword = false) |
| | | { |
| | | this.titleText = i_title; |
| | | this.textValue = i_text; |
| | | this.emptyMsg = i_emptyMsg; |
| | | |
| | | //确认按钮文本 |
| | | this.buttonOkText = i_buttonOkText == null ? Language.StringByID(StringId.Confirm) : i_buttonOkText; |
| | | this.buttonCancelText = i_buttonCancelText == null ? Language.StringByID(StringId.Cancel) : i_buttonCancelText; |
| | | |
| | | this.isPassword = i_isPassword; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 弹窗显示___________________________ |
| | | |
| | | /// <summary> |
| | | /// 弹窗显示 |
| | | /// </summary> |
| | | /// <param name="finishEvent">回调函数,参数为输入框的值</param> |
| | | public void Show(Action<string> finishEvent) |
| | | { |
| | | var dialogForm = new Dialog(); |
| | | dialogForm.BackgroundColor = CSS_Color.DialogTransparentColor1; |
| | | //主控件 |
| | | var frameMain = new NormalFrameLayout(); |
| | | dialogForm.AddChidren(frameMain); |
| | | dialogForm.Show(); |
| | | |
| | | //中间区域 |
| | | var frameCenter = new NormalFrameLayout(); |
| | | frameCenter.Gravity = Gravity.Center; |
| | | frameCenter.Width = Application.GetRealWidth(270); |
| | | frameCenter.Height = Application.GetRealHeight(50); |
| | | frameCenter.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | frameCenter.Radius = (uint)Application.GetMinRealAverage(10); |
| | | frameMain.AddChidren(frameCenter); |
| | | |
| | | //标题 |
| | | var btnTitle = new NormalViewControl(frameCenter.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(24), false); |
| | | btnTitle.Y = Application.GetRealHeight(19); |
| | | btnTitle.Gravity = Gravity.CenterHorizontal; |
| | | btnTitle.TextColor = CSS_Color.MainColor; |
| | | btnTitle.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnTitle.TextAlignment = TextAlignment.Center; |
| | | btnTitle.IsBold = true; |
| | | btnTitle.Text = this.titleText.Replace("{0}", "\r\n"); |
| | | btnTitle.Height = Application.GetRealHeight(24) * btnTitle.GetRealRowCountByText(); |
| | | btnTitle.IsMoreLines = true; |
| | | frameCenter.AddChidren(btnTitle); |
| | | |
| | | //输入框的背景 |
| | | var frameInput = new FrameLayout(); |
| | | frameInput.Y = btnTitle.Bottom + Application.GetRealHeight(16); |
| | | frameInput.Width = Application.GetRealWidth(222); |
| | | frameInput.Height = Application.GetRealHeight(40); |
| | | frameInput.Gravity = Gravity.CenterHorizontal; |
| | | frameInput.Radius = (uint)Application.GetRealWidth(4); |
| | | frameInput.BackgroundColor = CSS_Color.BackgroundColor; |
| | | frameCenter.AddChidren(frameInput); |
| | | //输入框 |
| | | var txtInput = new TextInputControl(174, 24, true); |
| | | txtInput.X = Application.GetRealWidth(12); |
| | | txtInput.Gravity = Gravity.CenterVertical; |
| | | txtInput.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | txtInput.Text = this.textValue; |
| | | frameInput.AddChidren(txtInput); |
| | | |
| | | //密码型 |
| | | if (this.isPassword == true) |
| | | { |
| | | txtInput.IsNumberKeyboardType = true; |
| | | txtInput.SecureTextEntry = true; |
| | | //密码可视图标 |
| | | var btnIcon = new IconViewControl(24); |
| | | btnIcon.X = txtInput.Right + Application.GetRealWidth(8); |
| | | btnIcon.Gravity = Gravity.CenterVertical; |
| | | btnIcon.UnSelectedImagePath = "LoginIcon/HidePasswordIcon.png"; |
| | | btnIcon.SelectedImagePath = "LoginIcon/ShowPasswordIcon.png"; |
| | | frameInput.AddChidren(btnIcon); |
| | | btnIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | btnIcon.IsSelected = !btnIcon.IsSelected; |
| | | txtInput.SecureTextEntry = !txtInput.SecureTextEntry; |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | //取消图标 |
| | | var btnIcon = new IconViewControl(24); |
| | | btnIcon.X = txtInput.Right + Application.GetRealWidth(8); |
| | | btnIcon.Gravity = Gravity.CenterVertical; |
| | | btnIcon.UnSelectedImagePath = "LoginIcon/1.png"; |
| | | frameInput.AddChidren(btnIcon); |
| | | btnIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | txtInput.Text = string.Empty; |
| | | }; |
| | | } |
| | | |
| | | //错误显示消息 |
| | | var btnErrorMsg = new NormalViewControl(frameInput.Width, Application.GetRealHeight(21), false); |
| | | btnErrorMsg.Y = frameInput.Bottom; |
| | | btnErrorMsg.Gravity = Gravity.CenterHorizontal; |
| | | btnErrorMsg.TextColor = CSS_Color.WarningColor; |
| | | btnErrorMsg.Text = this.emptyMsg.Replace("{0}", "\r\n"); |
| | | btnErrorMsg.IsMoreLines = true; |
| | | btnErrorMsg.TextAlignment = TextAlignment.TopLeft; |
| | | btnErrorMsg.Height = Application.GetRealHeight(21) * btnErrorMsg.GetRealRowCountByText(); |
| | | btnErrorMsg.Visible = false; |
| | | frameCenter.AddChidren(btnErrorMsg); |
| | | |
| | | //底部按钮的高度 |
| | | int buttomButtonHeigth = Application.GetRealHeight(43); |
| | | //调整白色桌布的高度和坐标 |
| | | frameCenter.Height = frameInput.Bottom + Application.GetRealHeight(31) + buttomButtonHeigth; |
| | | //白色背景在蓝湖上的坐标为264,高度为172 然后让它按这个比例置于桌布 |
| | | frameCenter.Y = Application.GetRealHeight(264) - (frameCenter.Height - Application.GetRealHeight(172)) / 2; |
| | | |
| | | //取消 |
| | | var btnCancel = new NormalViewControl(frameCenter.Width / 2, buttomButtonHeigth, false); |
| | | btnCancel.Gravity = Gravity.BottomLeft; |
| | | btnCancel.TextAlignment = TextAlignment.Center; |
| | | btnCancel.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnCancel.Text = this.buttonCancelText; |
| | | frameCenter.AddChidren(btnCancel); |
| | | btnCancel.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //关闭界面 |
| | | dialogForm.Close(); |
| | | finishEvent = null; |
| | | }; |
| | | //线 |
| | | var btnLine = new NormalViewControl(frameCenter.Width / 2, HdlControlResourse.BottomLineHeight, false); |
| | | btnLine.Y = btnCancel.Y - HdlControlResourse.BottomLineHeight; |
| | | btnLine.BackgroundColor = CSS_Color.DividingLineColor; |
| | | frameCenter.AddChidren(btnLine); |
| | | |
| | | //确认 |
| | | var btnConfirm = new NormalViewControl(frameCenter.Width - btnCancel.Width, buttomButtonHeigth + HdlControlResourse.BottomLineHeight, false); |
| | | btnConfirm.X = btnCancel.Right; |
| | | btnConfirm.Y = btnLine.Y; |
| | | btnConfirm.TextAlignment = TextAlignment.Center; |
| | | btnConfirm.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnConfirm.TextColor = CSS_Color.MainBackgroundColor; |
| | | btnConfirm.BackgroundColor = CSS_Color.MainColor; |
| | | btnConfirm.Text = this.buttonOkText; |
| | | frameCenter.AddChidren(btnConfirm); |
| | | btnConfirm.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomRight); |
| | | btnConfirm.ButtonClickEvent += (sender, e) => |
| | | { |
| | | string inputValue = txtInput.Text.Trim(); |
| | | if (inputValue == string.Empty && string.IsNullOrEmpty(this.emptyMsg) != true) |
| | | { |
| | | //空白的时候,提示消息 |
| | | btnErrorMsg.Visible = true; |
| | | |
| | | //看看消息显示的控件有没有大于31,大于的话,则算出它增加的宽度(31是输入框到底部按钮Y轴的空白区域) |
| | | int value = 0; |
| | | if (btnErrorMsg.Height > Application.GetRealHeight(31)) |
| | | { |
| | | //5是与底部按钮Y轴的间距 |
| | | value = btnErrorMsg.Height - Application.GetRealHeight(31) + Application.GetRealHeight(5); |
| | | } |
| | | //调整白色桌布的高度和坐标 |
| | | frameCenter.Height = frameInput.Bottom + Application.GetRealHeight(31) + buttomButtonHeigth + value; |
| | | //白色背景在蓝湖上的坐标为264,高度为172 然后让它按这个比例置于桌布 |
| | | frameCenter.Y = Application.GetRealHeight(264) - (frameCenter.Height - Application.GetRealHeight(172)) / 2; |
| | | //两个按钮置底 |
| | | btnCancel.Gravity = Gravity.BottomLeft; |
| | | btnLine.Y = btnCancel.Y - HdlControlResourse.BottomLineHeight; |
| | | btnConfirm.Y = btnLine.Y; |
| | | |
| | | return; |
| | | } |
| | | //关闭界面 |
| | | dialogForm.Close(); |
| | | //回调函数 |
| | | finishEvent?.Invoke(txtInput.Text.Trim()); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | public enum ShowMsgType
|
| | | {
|
| | | /// <summary>
|
| | | /// 普通提示类型
|
| | | /// <para>普通提示类型(下面这种样式)</para>
|
| | | /// <para>╭─────────╮</para>
|
| | | /// <para>│ 提示 │</para>
|
| | | /// <para>│ 显示的消息 │</para>
|
| | | /// <para>├─────────┤</para>
|
| | | /// <para>│ 确认 │</para>
|
| | | /// <para>╰─────────╯</para>
|
| | | /// </summary>
|
| | | Normal = 1,
|
| | | /// <summary>
|
| | | /// 确认类型
|
| | | /// <para>确认类型(下面这种样式)</para>
|
| | | /// <para>╭─────────╮</para>
|
| | | /// <para>│ 提示 │</para>
|
| | | /// <para>│ 显示的消息 │</para>
|
| | | /// <para>├─────────┤</para>
|
| | | /// <para>│ 取消 │ 确认 │</para>
|
| | | /// <para>╰─────────╯</para>
|
| | | /// </summary>
|
| | | Confirm = 2,
|
| | | /// <summary>
|
| | | /// 错误类型
|
| | | /// <para>错误类型(下面这种样式)</para>
|
| | | /// <para>╭─────────╮</para>
|
| | | /// <para>│ 错误 │</para>
|
| | | /// <para>│ 显示的消息 │</para>
|
| | | /// <para>├─────────┤</para>
|
| | | /// <para>│ 确认 │</para>
|
| | | /// <para>╰─────────╯</para>
|
| | | /// </summary>
|
| | | Error = 3,
|
| | | /// <summary>
|
| | | /// Tip类型
|
| | | /// <para>Tip类型(下面这种样式)</para>
|
| | | /// <para>╭─────────╮</para>
|
| | | /// <para>│ 显示的消息 │</para>
|
| | | /// <para>╰─────────╯</para>
|
| | | /// </summary>
|
| | | Tip = 4,
|
| | | /// <summary>
|
| | | /// 提醒类型
|
| | | /// <para>Tip提醒类型1(下面这种样式)</para>
|
| | | /// <para>╭──────────╮</para>
|
| | | /// <para>│ 三角形感叹号小图标 │</para>
|
| | | /// <para>│ 显示的消息 │</para>
|
| | | /// <para>╰──────────╯</para>
|
| | | /// </summary>
|
| | | Remind = 5
|
| | | TipRemind = 5,
|
| | | /// <summary>
|
| | | /// <para>Tip提醒类型2(下面这种样式)</para>
|
| | | /// <para>╭──────────╮</para>
|
| | | /// <para>│ 圆形打勾小图标 │</para>
|
| | | /// <para>│ 显示的消息 │</para>
|
| | | /// <para>╰──────────╯</para>
|
| | | /// </summary>
|
| | | TipSuccess = 6,
|
| | | /// <summary>
|
| | | /// <para>成功确认类型(下面这种样式)</para>
|
| | | /// <para></para>
|
| | | /// <para>╭──圆形打勾的大图标──╮</para>
|
| | | /// <para>│ │</para>
|
| | | /// <para>│ 显示的消息 │</para>
|
| | | /// <para>│ ╭──────╮ │</para>
|
| | | /// <para>│ │ 确认 │ │</para>
|
| | | /// <para>│ ╰──────╯ │ </para>
|
| | | /// <para>╰────────────╯</para>
|
| | | /// </summary>
|
| | | ConfirmSuccess = 7,
|
| | | /// <summary>
|
| | | /// <para>失败确认类型(下面这种样式)</para>
|
| | | /// <para></para>
|
| | | /// <para>╭──圆形打叉的大图标──╮</para>
|
| | | /// <para>│ │</para>
|
| | | /// <para>│ 显示的消息 │</para>
|
| | | /// <para>│ ╭──────╮ │</para>
|
| | | /// <para>│ │ 确认 │ │</para>
|
| | | /// <para>│ ╰──────╯ │ </para>
|
| | | /// <para>╰────────────╯</para>
|
| | | /// </summary>
|
| | | ConfirmFail = 8,
|
| | | }
|
| | |
|
| | | /// <summary>
|
New file |
| | |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | /// <summary> |
| | | /// App手势验证界面 |
| | | /// </summary> |
| | | public class AppGestureSecurityForm : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// <para>Action事件</para> |
| | | /// <para>1:密码输入结束,这个时候,第二个参数为输入的密码</para> |
| | | /// <para>2:点击了底部的消息</para> |
| | | /// </summary> |
| | | public Action<int, string> ActionEvent = null; |
| | | /// <summary> |
| | | /// 手势控件 |
| | | /// </summary> |
| | | private GestureLockView gestureLockView = null; |
| | | /// <summary> |
| | | /// 消息控件 |
| | | /// </summary> |
| | | private NormalViewControl btnMsg = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | /// <param name="addTopFrame">是否添加头部Frame</param> |
| | | /// <param name="i_title">标题信息</param> |
| | | /// <param name="i_bottomMsg">底部显示的信息行</param> |
| | | public void ShowForm(bool addTopFrame, string i_title, string i_bottomMsg) |
| | | { |
| | | //不允许左滑 |
| | | this.ScrollLeftEnabled = false; |
| | | |
| | | if (addTopFrame == false) |
| | | { |
| | | //清空头部全部控件 |
| | | topFrameLayout.RemoveAll(); |
| | | //然后让背景色一体化 |
| | | topFrameLayout.BackgroundColor = bodyFrameLayout.BackgroundColor; |
| | | topMenuFrameLayout.BackgroundColor = bodyFrameLayout.BackgroundColor; |
| | | } |
| | | else |
| | | { |
| | | //验证手势密码 |
| | | base.SetTitleText(Language.StringByID(StringId.VerifyGesturePassword)); |
| | | } |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(i_title, i_bottomMsg); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | /// <param name="i_title">标题信息</param> |
| | | /// <param name="i_bottomMsg">底部显示的信息行</param> |
| | | private void InitMiddleFrame(string i_title, string i_bottomMsg) |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | //标题 |
| | | var btnTitle = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(36), false); |
| | | btnTitle.Y = Application.GetRealHeight(164) - topFrameLayout.Bottom; |
| | | btnTitle.Gravity = Gravity.CenterHorizontal; |
| | | btnTitle.TextAlignment = TextAlignment.Center; |
| | | btnTitle.IsBold = true; |
| | | btnTitle.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnTitle.TextSize = CSS_FontSize.EmphasisFontSize_Secondary; |
| | | btnTitle.Text = i_title; |
| | | bodyFrameLayout.AddChidren(btnTitle); |
| | | |
| | | //请绘制图案 |
| | | this.btnMsg = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(72), false); |
| | | btnMsg.Y = btnTitle.Bottom; |
| | | btnMsg.Gravity = Gravity.CenterHorizontal; |
| | | btnMsg.TextAlignment = TextAlignment.TopCenter; |
| | | btnMsg.IsBold = true; |
| | | btnMsg.IsMoreLines = true; |
| | | btnMsg.SelectedTextColor = CSS_Color.WarningColor; |
| | | btnMsg.TextID = StringId.PleaseDrawPattern; |
| | | bodyFrameLayout.AddChidren(btnMsg); |
| | | |
| | | //原始它与btnDrawMsg的间隔是14 |
| | | this.gestureLockView = new GestureLockView(); |
| | | gestureLockView.Y = btnMsg.Bottom; |
| | | gestureLockView.Gravity = Gravity.CenterHorizontal; |
| | | gestureLockView.Width = Application.GetRealWidth(215); |
| | | gestureLockView.Height = Application.GetRealWidth(215); |
| | | gestureLockView.LockViewCorrectColor = CSS_Color.MainColor;//0xFF00FF00,//默认和正确 时显示的颜色 |
| | | gestureLockView.LockViewErrorColor = 0xFFFF0000; //错误时 显示的颜色 |
| | | gestureLockView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | bodyFrameLayout.AddChidren(gestureLockView); |
| | | gestureLockView.SetSolidType(true); |
| | | //滑动结束 回调密码结果和密码长度 |
| | | gestureLockView.OnLockVerifyEvent += (selectNumStr, selectCount) => |
| | | { |
| | | //自行验证密码,提示正确或者错误 false为显示红色错误, 自行选择调用时机 |
| | | this.gestureLockView.showCorrectStatus(false); |
| | | if (selectCount < 4) |
| | | { |
| | | //至少连接4个点,请重新绘制 |
| | | btnMsg.Text = Language.StringByID(StringId.DrawingLengthError); |
| | | btnMsg.TextColor = CSS_Color.WarningColor; |
| | | return; |
| | | } |
| | | this.ActionEvent?.Invoke(1, selectNumStr); |
| | | }; |
| | | |
| | | //底部消息 |
| | | if (string.IsNullOrEmpty(i_bottomMsg) == false) |
| | | { |
| | | var btnBottomTip = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, 20, false); |
| | | btnBottomTip.Y = Application.GetRealHeight(517) - topFrameLayout.Bottom; |
| | | btnBottomTip.Gravity = Gravity.CenterHorizontal; |
| | | btnBottomTip.TextAlignment = TextAlignment.TopCenter; |
| | | btnBottomTip.TextColor = CSS_Color.MainColor; |
| | | btnBottomTip.Text = i_bottomMsg; |
| | | btnBottomTip.Height = btnBottomTip.GetRealRowCountByText() * Application.GetRealHeight(24); |
| | | btnBottomTip.IsMoreLines = true; |
| | | bodyFrameLayout.AddChidren(btnBottomTip); |
| | | btnBottomTip.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.ActionEvent?.Invoke(2, null); |
| | | }; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 界面关闭___________________________ |
| | | |
| | | /// <summary> |
| | | /// 界面关闭 |
| | | /// </summary> |
| | | public override void CloseFormBefore() |
| | | { |
| | | base.CloseFormBefore(); |
| | | |
| | | this.ActionEvent = null; |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 显示错误消息 |
| | | /// </summary> |
| | | /// <param name="i_errorMsg">需要显示的错误消息</param> |
| | | public void ShowErrorMsg(string i_errorMsg) |
| | | { |
| | | btnMsg.Text = i_errorMsg; |
| | | btnMsg.TextColor = CSS_Color.WarningColor; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | /// <summary> |
| | | /// App数字密码验证界面 |
| | | /// </summary> |
| | | public class AppNumPasswordSecurityForm : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// <para>Action事件</para> |
| | | /// <para>1:密码输入结束,这个时候,第二个参数为输入的密码</para> |
| | | /// <para>2:点击了底部的消息</para> |
| | | /// </summary> |
| | | public Action<int, string> ActionEvent = null; |
| | | /// <summary> |
| | | /// 图标控件集合 |
| | | /// </summary> |
| | | private List<IconViewControl> listIconContr = new List<IconViewControl>(); |
| | | /// <summary> |
| | | /// 消息控件 |
| | | /// </summary> |
| | | private NormalViewControl btnErrorMsg = null; |
| | | /// <summary> |
| | | /// 一个高度为0的输入框 |
| | | /// </summary> |
| | | private EditText txtPassword = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | /// <param name="addTopFrame">是否添加头部Frame</param> |
| | | /// <param name="i_title">标题信息</param> |
| | | /// <param name="i_bottomMsg">底部显示的信息行</param> |
| | | public void ShowForm(bool addTopFrame, string i_title, string i_bottomMsg) |
| | | { |
| | | //不允许左滑 |
| | | this.ScrollLeftEnabled = false; |
| | | |
| | | if (addTopFrame == false) |
| | | { |
| | | //清空头部全部控件 |
| | | topFrameLayout.RemoveAll(); |
| | | //然后让背景色一体化 |
| | | topFrameLayout.BackgroundColor = bodyFrameLayout.BackgroundColor; |
| | | topMenuFrameLayout.BackgroundColor = bodyFrameLayout.BackgroundColor; |
| | | } |
| | | else |
| | | { |
| | | //验证数字密码 |
| | | base.SetTitleText(Language.StringByID(StringId.VerifyDigitalPassword)); |
| | | } |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(i_title, i_bottomMsg); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | /// <param name="i_title">标题信息</param> |
| | | /// <param name="i_bottomMsg">底部显示的信息行</param> |
| | | private void InitMiddleFrame(string i_title, string i_bottomMsg) |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | //标题 |
| | | var btnTitle = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(42), false); |
| | | btnTitle.Y = Application.GetRealHeight(228) - topFrameLayout.Bottom; |
| | | btnTitle.Gravity = Gravity.CenterHorizontal; |
| | | btnTitle.TextAlignment = TextAlignment.Center; |
| | | btnTitle.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnTitle.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnTitle.Text = i_title; |
| | | bodyFrameLayout.AddChidren(btnTitle); |
| | | |
| | | //第一个圆圈 |
| | | var btnIcon1 = this.InitIconControl(); |
| | | btnIcon1.X = Application.GetRealWidth(132); |
| | | btnIcon1.Y = btnTitle.Bottom + Application.GetRealWidth(10); |
| | | |
| | | //第二个圆圈 |
| | | var btnIcon2 = this.InitIconControl(); |
| | | btnIcon2.X = btnIcon1.Right + Application.GetRealWidth(16); |
| | | btnIcon2.Y = btnIcon1.Y; |
| | | |
| | | //第三个圆圈 |
| | | var btnIcon3 = this.InitIconControl(); |
| | | btnIcon3.X = btnIcon2.Right + Application.GetRealWidth(16); |
| | | btnIcon3.Y = btnIcon1.Y; |
| | | |
| | | //第四个圆圈 |
| | | var btnIcon4 = this.InitIconControl(); |
| | | btnIcon4.X = btnIcon3.Right + Application.GetRealWidth(16); |
| | | btnIcon4.Y = btnIcon1.Y; |
| | | |
| | | //错误消息 |
| | | this.btnErrorMsg = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(24), false); |
| | | btnErrorMsg.Y = btnIcon1.Bottom + Application.GetRealHeight(4); |
| | | btnErrorMsg.Gravity = Gravity.CenterHorizontal; |
| | | btnErrorMsg.TextColor = CSS_Color.WarningColor; |
| | | btnErrorMsg.TextAlignment = TextAlignment.Center; |
| | | btnErrorMsg.IsMoreLines = true; |
| | | bodyFrameLayout.AddChidren(btnErrorMsg); |
| | | |
| | | //底部消息 |
| | | if (string.IsNullOrEmpty(i_bottomMsg) == false) |
| | | { |
| | | var btnBottomTip = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, 20, false); |
| | | btnBottomTip.Y = Application.GetRealHeight(517) - topFrameLayout.Bottom; |
| | | btnBottomTip.Gravity = Gravity.CenterHorizontal; |
| | | btnBottomTip.TextAlignment = TextAlignment.TopCenter; |
| | | btnBottomTip.TextColor = CSS_Color.MainColor; |
| | | btnBottomTip.Text = i_bottomMsg; |
| | | btnBottomTip.Height = btnBottomTip.GetRealRowCountByText() * Application.GetRealHeight(24); |
| | | btnBottomTip.IsMoreLines = true; |
| | | bodyFrameLayout.AddChidren(btnBottomTip); |
| | | btnBottomTip.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.ActionEvent?.Invoke(2, null); |
| | | }; |
| | | } |
| | | |
| | | //密码输入框 |
| | | this.txtPassword = new EditText(); |
| | | txtPassword.IsNumberKeyboardType = true; |
| | | txtPassword.Height = 0; |
| | | bodyFrameLayout.AddChidren(txtPassword); |
| | | txtPassword.Foucs = true; |
| | | txtPassword.TextChangeEventHandler = (sender, e) => |
| | | { |
| | | string passwrod = txtPassword.Text.Trim(); |
| | | btnErrorMsg.Text = string.Empty; |
| | | for (int i = 0; i < 4; i++) |
| | | { |
| | | if (i < passwrod.Length) |
| | | { |
| | | //实心图标 |
| | | this.listIconContr[i].IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | //空心图标 |
| | | this.listIconContr[i].IsSelected = false; |
| | | } |
| | | } |
| | | if (passwrod.Length == 4) |
| | | { |
| | | //关闭输入法 |
| | | Application.HideSoftInput(); |
| | | |
| | | this.ActionEvent?.Invoke(1, passwrod); |
| | | } |
| | | }; |
| | | |
| | | bodyFrameLayout.ButtonClickEvent += (sedner, e) => |
| | | { |
| | | txtPassword.Foucs = true; |
| | | }; |
| | | btnIcon1.ButtonClickEvent += (sender, e) => { bodyFrameLayout.ButtonClickEvent(null, null); }; |
| | | btnIcon2.ButtonClickEvent += (sender, e) => { bodyFrameLayout.ButtonClickEvent(null, null); }; |
| | | btnIcon3.ButtonClickEvent += (sender, e) => { bodyFrameLayout.ButtonClickEvent(null, null); }; |
| | | btnIcon4.ButtonClickEvent += (sender, e) => { bodyFrameLayout.ButtonClickEvent(null, null); }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化图标控件 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private IconViewControl InitIconControl() |
| | | { |
| | | var btnIcon1 = new IconViewControl(16); |
| | | btnIcon1.BorderColor = CSS_Color.FirstLevelTitleColor; |
| | | btnIcon1.BorderWidth = (uint)Application.GetRealWidth(1); |
| | | btnIcon1.Radius = (uint)Application.GetRealWidth(8); |
| | | btnIcon1.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | btnIcon1.SelectedBackgroundColor = CSS_Color.FirstLevelTitleColor; |
| | | bodyFrameLayout.AddChidren(btnIcon1); |
| | | |
| | | //加入缓存 |
| | | this.listIconContr.Add(btnIcon1); |
| | | |
| | | return btnIcon1; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 界面关闭___________________________ |
| | | |
| | | /// <summary> |
| | | /// 界面关闭 |
| | | /// </summary> |
| | | public override void CloseFormBefore() |
| | | { |
| | | base.CloseFormBefore(); |
| | | |
| | | this.ActionEvent = null; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 显示错误消息 |
| | | /// </summary> |
| | | /// <param name="i_errorMsg">需要显示的错误消息</param> |
| | | public void ShowErrorMsg(string i_errorMsg) |
| | | { |
| | | this.txtPassword.Text = string.Empty; |
| | | btnErrorMsg.Text = i_errorMsg; |
| | | btnErrorMsg.Height = btnErrorMsg.GetRealRowCountByText() * Application.GetRealHeight(24); |
| | | //全部弄成空心图标 |
| | | for (int i = 0; i < this.listIconContr.Count; i++) |
| | | { |
| | | this.listIconContr[i].IsSelected = false; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | /// <summary>
|
| | | /// 画面的ID(自动编号,唯一主键,和各页面并无任何逻辑关系,但是它的用处大着呢)
|
| | | /// </summary> |
| | | public string FormID = string.Empty; |
| | | public string FormID = string.Empty;
|
| | | /// <summary>
|
| | | /// 左滑使能
|
| | | /// </summary> |
| | | private bool m_ScrollLeftEnabled = true; |
| | | /// <summary>
|
| | | /// 左滑使能(界面关闭时,底层会还原,无需再处理)
|
| | | /// </summary> |
| | | public bool ScrollLeftEnabled
|
| | | {
|
| | | get { return m_ScrollLeftEnabled; }
|
| | | set
|
| | | {
|
| | | if (MainPage.BasePageView.ScrollEnabled != value)
|
| | | {
|
| | | MainPage.BasePageView.ScrollEnabled = value;
|
| | | this.m_ScrollLeftEnabled = value;
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
| | | #endregion
|
| | |
|
| | | #region ■ 一般的方法_________________________ |
| | |
|
| | | /// <summary>
|
| | | /// 显示信息框
|
| | | /// </summary>
|
| | | /// <param name="msgType">信息类型</param>
|
| | | /// <param name="msg">信息</param>
|
| | | /// <param name="action">单击确认后执行的回调函数</param>
|
| | | /// <param name="buttonText">按钮的文本</param> |
| | | /// <param name="i_waitTime">等待时间,单位为秒,设置确认按钮在多长时间后才能够点击</param>
|
| | | public void ShowMassage(ShowMsgType msgType, string msg, Action action = null, string buttonText = null, int i_waitTime = -1)
|
| | | {
|
| | | HdlMessageLogic.Current.ShowMassage(msgType, msg, action, buttonText, i_waitTime); |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 判断当前正在活动的界面是否是当前这个界面
|
| | |
| | | return value1;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取文本的真实宽度
|
| | | /// </summary>
|
| | | /// <param name="i_text">需要计算的文本</param>
|
| | | /// <param name="i_size">字体大小</param>
|
| | | /// <param name="i_isBold">是否是粗体</param>
|
| | | /// <returns></returns>
|
| | | public int GetTextRealWidth(string i_text, int i_size, bool i_isBold = false)
|
| | | {
|
| | | //定义一个临时的控件
|
| | | var btnTemp = new ButtonCtrBase();
|
| | | btnTemp.TextSize = i_size;
|
| | | btnTemp.IsBold = i_isBold;
|
| | | btnTemp.Text = i_text;
|
| | |
|
| | | return btnTemp.GetRealWidthByText();
|
| | | }
|
| | |
|
| | | #endregion |
| | |
|
| | | #region ■ 反射方法___________________________ |
| | |
| | | btnTilte.TextSize = UI.CSS.CSS_FontSize.HeadlineFontSize;
|
| | | btnTilte.TextColor = UI.CSS.CSS_Color.FirstLevelTitleColor;
|
| | | topFrameLayout.AddChidren(btnTilte); |
| | | topFrameLayout.AddTag("txtTitle", btnTilte); |
| | | topFrameLayout.AddTag("txtTitle", btnTilte);
|
| | | #if DEBUG
|
| | | btnTilte.MouseLongEventHandler += (sender, e) =>
|
| | | {
|
| | |
|
| | | var form = new BottomMenuSelectControl(3);
|
| | | form.AddMenu("切换为中文", () =>
|
| | | {
|
| | | Language.CurrentLanguage = "Chinese";
|
| | | //清除全部控件
|
| | | this.ClearBodyFrame();
|
| | | //执行ShowForm()方法实现重新加载
|
| | | this.LoadShowFormMethod(this.m_parameter);
|
| | | });
|
| | | form.AddMenu("切换为英文", () =>
|
| | | {
|
| | | Language.CurrentLanguage = "English";
|
| | | //清除全部控件
|
| | | this.ClearBodyFrame();
|
| | | //执行ShowForm()方法实现重新加载
|
| | | this.LoadShowFormMethod(this.m_parameter);
|
| | | });
|
| | | form.AddMenu("查看本地文件", () =>
|
| | | {
|
| | | var form2 = new HideOptionDirectoryListForm();
|
| | | form2.AddForm();
|
| | | });
|
| | | };
|
| | | #endif |
| | | } |
| | |
|
| | | #endregion |
| | |
| | | /// </summary>
|
| | | public Action SettionFinishEvent = null;
|
| | | /// <summary>
|
| | | /// 左右翻页的控件的事件
|
| | | /// </summary>
|
| | | public Action<int> PageChangeEvent = null;
|
| | | /// <summary>
|
| | | /// 左右整个翻页的控件
|
| | | /// </summary>
|
| | | private PageLayout pageLayout = null;
|
| | |
| | | {
|
| | | //设置底部两个按钮的状态
|
| | | this.SetBottomTwoButtonStatu();
|
| | | this.PageChangeEvent?.Invoke(index);
|
| | | };
|
| | |
|
| | | //初始化第一个索引的桌布
|
| | |
| | | this.pageLayout.PageIndex = 0;
|
| | | //设置底部两个按钮的状态
|
| | | this.SetBottomTwoButtonStatu();
|
| | | if (this.FrameWhiteCentet2 != null && this.pageLayout.ScrollEnabled == false)
|
| | | {
|
| | | this.pageLayout.ScrollEnabled = true;
|
| | | }
|
| | | };
|
| | | this.btnBottomTwo = new NormalViewControl(14, 6, true);
|
| | | btnBottomTwo.X = btnBottomOne.Right + Application.GetRealWidth(8);
|
| | |
| | | this.pageLayout.PageIndex = 1;
|
| | | //设置底部两个按钮的状态
|
| | | this.SetBottomTwoButtonStatu();
|
| | | if (this.FrameWhiteCentet2 != null && this.pageLayout.ScrollEnabled == false)
|
| | | {
|
| | | this.pageLayout.ScrollEnabled = true;
|
| | | }
|
| | | };
|
| | | }
|
| | |
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | base.CloseFormBefore();
|
| | |
|
| | | this.SettionFinishEvent = null;
|
| | | this.PageChangeEvent = null;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取头部右边的【设置】图标控件
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public PicViewControl GetTopSettingIcon()
|
| | | {
|
| | | for (int i = 0; i < topFrameLayout.ChildrenCount; i++)
|
| | | {
|
| | | var myView = topFrameLayout.GetChildren(i);
|
| | | if (myView == null || myView.Name != "btnSetting")
|
| | | {
|
| | | continue;
|
| | | }
|
| | | return myView as PicViewControl;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 添加头部【设置】的图标
|
| | |
| | | /// <param name="btnHigherDeviceName">上一级界面的设备名字控件(原来on的框架太坑)</param>
|
| | | private void AddTopSettingIcon(Button btnHigherDeviceName, Button btnHigherRoom)
|
| | | {
|
| | | //如果是成员没有功能
|
| | | if (DB_ResidenceData.Instance.CurrentRegion.IsOthreShare == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //设置图标
|
| | | //设置图标(门锁界面需要借用这个图标的X轴和Y轴,所以加进来)
|
| | | var btnSetting = new PicViewControl(28, 28);
|
| | | btnSetting.X = Application.GetRealWidth(337);
|
| | | btnSetting.Y = Application.GetRealHeight(9);
|
| | | btnSetting.UnSelectedImagePath = "Public/FuncInfoSetIcon.png";
|
| | | btnSetting.Name = "btnSetting";
|
| | | topFrameLayout.AddChidren(btnSetting);
|
| | |
|
| | | //如果是成员没有功能
|
| | | if (DB_ResidenceData.Instance.CurrentRegion.IsOthreShare == true)
|
| | | {
|
| | | btnSetting.Visible = false;
|
| | | }
|
| | |
|
| | | btnSetting.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var infoView = new UI.FunctionBaseInfoSetPage(this.device, () =>
|
| | |
| | | bodyFrameLayout.AddChidren(btnButon);
|
| | | btnButon.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Confirm, "是否清除该文件夹", () =>
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, "是否清除该文件夹", () =>
|
| | | {
|
| | | try
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Error, "清除缓存文件夹异常");
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, "清除缓存文件夹异常");
|
| | | }
|
| | | });
|
| | | };
|
New file |
| | |
| | | using Shared; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | /// <summary> |
| | | /// 共通检测逻辑 |
| | | /// </summary> |
| | | public class HdlCheckLogic |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 共通检测逻辑 |
| | | /// </summary> |
| | | private static HdlCheckLogic m_Current = null; |
| | | /// <summary> |
| | | /// 共通检测逻辑 |
| | | /// </summary> |
| | | public static HdlCheckLogic Current |
| | | { |
| | | get |
| | | { |
| | | if (m_Current == null) |
| | | { |
| | | m_Current = new HdlCheckLogic(); |
| | | } |
| | | return m_Current; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 验证解锁认证_______________________ |
| | | |
| | | /// <summary> |
| | | /// 验证解锁认证 |
| | | /// </summary> |
| | | /// <param name="addTopFrame">验证界面是否添加头部Frame(只对手势密码和数字密码有效)</param> |
| | | /// <param name="successEvent">验证成功之后的回调函数,失败不会回调</param> |
| | | /// <param name="loadPageBeforEvent">加载指定解锁认证界面之前的事件,0:取消当前验证并切换到其他方式,1:数字密码,2:手势密码,3:指纹密码,4:面容ID</param> |
| | | public void CheckUnlockSecurity(bool addTopFrame, Action successEvent, Action<string> loadPageBeforEvent = null) |
| | | { |
| | | //验证指纹和面容id都使用指纹验证 |
| | | if (UserInfo.Current.appUnlockType.Contains("3") || UserInfo.Current.appUnlockType.Contains("4")) |
| | | { |
| | | //先把这个东西置空 |
| | | TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; |
| | | |
| | | TouchIDUtils.TouchIDSupperType type = TouchIDUtils.getTouchIDSupperType(); |
| | | if (type == TouchIDUtils.TouchIDSupperType.TouchID) |
| | | { |
| | | //通知使用指纹验证 |
| | | loadPageBeforEvent?.Invoke("3"); |
| | | |
| | | //Touch ID验证 |
| | | TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent += (sender2, e2) => |
| | | { |
| | | if (e2 == TouchIDUtils.TouchIDState.Success) |
| | | { |
| | | //TouchID验证成功 |
| | | successEvent?.Invoke(); |
| | | successEvent = null; |
| | | loadPageBeforEvent = null; |
| | | TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; |
| | | } |
| | | else if (e2 == TouchIDUtils.TouchIDState.InputPassword) |
| | | { |
| | | //通知取消了验证,切换为其他验证 |
| | | loadPageBeforEvent?.Invoke("0"); |
| | | |
| | | //使用密码或者手势密码解锁认证 |
| | | this.CheckUnlockSecurityByPassword(addTopFrame, successEvent, loadPageBeforEvent); |
| | | } |
| | | }; |
| | | //提示数字密码验证还是绘制手势验证 |
| | | string strTitle = this.GetVerificationTitleString(); |
| | | |
| | | TouchIDUtils.Instance.showTouchIDWithDescribe(strTitle, Language.StringByID(StringId.PleaseVerifyTheFingerprint)); |
| | | } |
| | | //他关闭了手机的指纹验证 |
| | | else |
| | | { |
| | | //使用密码或者手势密码解锁认证 |
| | | this.CheckUnlockSecurityByPassword(addTopFrame, successEvent, loadPageBeforEvent); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //使用密码或者手势密码解锁认证 |
| | | this.CheckUnlockSecurityByPassword(addTopFrame, successEvent, loadPageBeforEvent); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 使用密码或者手势密码解锁认证 |
| | | /// </summary> |
| | | /// <param name="addTopFrame">验证界面是否添加头部Frame(只对手势密码和数字密码有效)</param> |
| | | /// <param name="successEvent">验证成功之后的回调函数,失败不会回调</param> |
| | | /// <param name="loadPageBeforEvent">加载指定解锁认证界面之前的事件,1:数字密码,2:手势密码,3:指纹密码,4:面容ID</param> |
| | | private void CheckUnlockSecurityByPassword(bool addTopFrame, Action successEvent, Action<string> loadPageBeforEvent = null) |
| | | { |
| | | if (UserInfo.Current.appUnlockType.Contains("1")) |
| | | { |
| | | //通知使用数字密码验证 |
| | | loadPageBeforEvent?.Invoke("1"); |
| | | |
| | | //显示数字密码解锁认证界面 |
| | | this.ShowAppNumPasswordSecurityForm(addTopFrame, successEvent); |
| | | } |
| | | else if (UserInfo.Current.appUnlockType.Contains("2")) |
| | | { |
| | | //通知使用手势密码验证 |
| | | loadPageBeforEvent?.Invoke("2"); |
| | | |
| | | //显示手势密码解锁认证界面 |
| | | this.ShowAppGestureSecurityForm(addTopFrame, successEvent); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示数字密码解锁认证界面 |
| | | /// </summary> |
| | | /// <param name="addTopFrame">验证界面是否添加头部Frame(只对手势密码和数字密码有效)</param> |
| | | /// <param name="successEvent">验证成功之后的回调函数,失败不会回调</param> |
| | | private void ShowAppNumPasswordSecurityForm(bool addTopFrame, Action successEvent) |
| | | { |
| | | var form = new AppNumPasswordSecurityForm(); |
| | | form.AddForm(addTopFrame, Language.StringByID(StringId.PlsEntryPassword), string.Empty); |
| | | form.ActionEvent += (div, password) => |
| | | { |
| | | //密码输入结束 |
| | | if (div == 1) |
| | | { |
| | | //密码正确 |
| | | if (UserInfo.Current.appUnlockPasswrod == password) |
| | | { |
| | | form.CloseForm(); |
| | | //回调 |
| | | successEvent?.Invoke(); |
| | | successEvent = null; |
| | | } |
| | | else |
| | | { |
| | | //验证失败,密码错误. |
| | | form.ShowErrorMsg(Language.StringByID(StringId.AuthenticationFailedPasswordError)); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示手势密码解锁认证界面 |
| | | /// </summary> |
| | | /// <param name="addTopFrame">验证界面是否添加头部Frame(只对手势密码和数字密码有效)</param> |
| | | /// <param name="successEvent">验证成功之后的回调函数,失败不会回调</param> |
| | | private void ShowAppGestureSecurityForm(bool addTopFrame, Action successEvent) |
| | | { |
| | | var form = new AppGestureSecurityForm(); |
| | | form.AddForm(addTopFrame, Language.StringByID(StringId.VerifyGesturePassword), string.Empty); |
| | | form.SetTitleText(string.Empty); |
| | | form.ActionEvent += (div, password) => |
| | | { |
| | | //密码输入结束 |
| | | if (div == 1) |
| | | { |
| | | //密码正确 |
| | | if (UserInfo.Current.appUnlockPasswrod == password) |
| | | { |
| | | form.CloseForm(); |
| | | //回调 |
| | | successEvent?.Invoke(); |
| | | successEvent = null; |
| | | } |
| | | else |
| | | { |
| | | //验证失败,密码错误. |
| | | form.ShowErrorMsg(Language.StringByID(StringId.AuthenticationFailedPasswordError)); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断是否数字验证、否则绘制手势验证 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private string GetVerificationTitleString() |
| | | { |
| | | //优先使用密码验证,密码验证和手势验证不共存 |
| | | if (UserInfo.Current.appUnlockType.Contains("1") == true) |
| | | { |
| | | return Language.StringByID(StringId.PasswordVerification); |
| | | } |
| | | else |
| | | { |
| | | return Language.StringByID(StringId.GestureVerification); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.Stan |
| | | { |
| | | /// <summary> |
| | | /// 一般的共通逻辑方法 |
| | | /// </summary> |
| | | public class HdlCommonLogic |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 界面相关的逻辑 |
| | | /// </summary> |
| | | private static HdlCommonLogic m_Current; |
| | | /// <summary> |
| | | /// 界面相关的逻辑 |
| | | /// </summary> |
| | | public static HdlCommonLogic Current |
| | | { |
| | | get |
| | | { |
| | | if (m_Current == null) |
| | | { |
| | | m_Current = new HdlCommonLogic(); |
| | | } |
| | | return m_Current; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 16进制转化_________________________ |
| | | |
| | | /// <summary> |
| | | /// 将16进制的文本翻译为正常文本 |
| | | /// </summary> |
| | | /// <param name="hexText">16进制的文本</param> |
| | | /// <param name="count">以多少个字节为一组</param> |
| | | /// <returns></returns> |
| | | public string TranslateHexadecimalIntoText(string hexText, int count = 2) |
| | | { |
| | | string textValue = string.Empty; |
| | | while (hexText.Length > 0) |
| | | { |
| | | string temp = hexText.Substring(0, count); |
| | | hexText = hexText.Substring(count); |
| | | int value = Convert.ToInt32(temp, 16); |
| | | textValue += ((char)value).ToString(); |
| | | } |
| | | return textValue; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 将文本翻译为16进制的文本 |
| | | /// </summary> |
| | | /// <param name="text">指定文本</param> |
| | | /// <returns></returns> |
| | | public string TranslateTextIntoHexadecimal(string text) |
| | | { |
| | | string textValue = string.Empty; |
| | | foreach (char c in text) |
| | | { |
| | | int value = Convert.ToInt32(c); |
| | | textValue += Convert.ToString(value, 16); |
| | | } |
| | | return textValue; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 加密和解密_________________________ |
| | | |
| | | /// <summary> |
| | | /// 加密密码 |
| | | /// </summary> |
| | | /// <param name="keys"></param> |
| | | /// <param name="strPsw"></param> |
| | | /// <returns></returns> |
| | | public string EncryptPassword(string keys, string strPsw) |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(strPsw) == true) |
| | | { |
| | | return strPsw; |
| | | } |
| | | var des = new System.Security.Cryptography.DESCryptoServiceProvider(); |
| | | byte[] inputByteArray = Encoding.Default.GetBytes(strPsw); |
| | | des.Key = ASCIIEncoding.ASCII.GetBytes(keys); |
| | | des.IV = ASCIIEncoding.ASCII.GetBytes(keys); |
| | | var ms = new System.IO.MemoryStream(); |
| | | var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write); |
| | | cs.Write(inputByteArray, 0, inputByteArray.Length); |
| | | cs.FlushFinalBlock(); |
| | | StringBuilder ret = new StringBuilder(); |
| | | foreach (byte b in ms.ToArray()) |
| | | { |
| | | ret.AppendFormat("{0:X2}", b); |
| | | } |
| | | return ret.ToString().ToLower(); |
| | | } |
| | | catch { return strPsw; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 解密密码 |
| | | /// </summary> |
| | | /// <param name="strPsw"></param> |
| | | /// <returns></returns> |
| | | public string DecryptPassword(string keys, string strPsw) |
| | | { |
| | | try |
| | | { |
| | | if (strPsw == string.Empty) |
| | | { |
| | | return strPsw; |
| | | } |
| | | var des = new System.Security.Cryptography.DESCryptoServiceProvider(); |
| | | |
| | | byte[] inputByteArray = new byte[strPsw.Length / 2]; |
| | | for (int x = 0; x < strPsw.Length / 2; x++) |
| | | { |
| | | int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16)); |
| | | inputByteArray[x] = (byte)i; |
| | | } |
| | | |
| | | des.Key = ASCIIEncoding.ASCII.GetBytes(keys); |
| | | des.IV = ASCIIEncoding.ASCII.GetBytes(keys); |
| | | var ms = new System.IO.MemoryStream(); |
| | | var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write); |
| | | cs.Write(inputByteArray, 0, inputByteArray.Length); |
| | | cs.FlushFinalBlock(); |
| | | |
| | | StringBuilder ret = new StringBuilder(); |
| | | |
| | | return System.Text.Encoding.Default.GetString(ms.ToArray()); |
| | | } |
| | | catch { return strPsw; } |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 时间转换___________________________ |
| | | |
| | | /// <summary> |
| | | /// 将utc时间类型的字符串(这种格式:2019-11-11T11:31:01),转换为本地时间 |
| | | /// </summary> |
| | | /// <param name="utcTimeText">utc时间,这种格式:2019-11-11T11:31:01</param> |
| | | /// <returns></returns> |
| | | public DateTime ConvertUtcTimeToLocalTime(string utcTimeText) |
| | | { |
| | | var utcTime = Convert.ToDateTime(utcTimeText); |
| | | return TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 将utc时间类型的字符串(这种格式:1597302318861,13位数),转换为本地时间 |
| | | /// </summary> |
| | | /// <param name="utcTimeText">utc时间,这种格式:1597302318861,13位数</param> |
| | | /// <returns></returns> |
| | | public DateTime ConvertUtcTimeToLocalTime2(string utcTimeText) |
| | | { |
| | | DateTime dtStart = new DateTime(1970, 1, 1); |
| | | long lTime = long.Parse(utcTimeText + "0000"); |
| | | TimeSpan toNow = new TimeSpan(lTime); |
| | | DateTime utcTime = dtStart.Add(toNow); |
| | | |
| | | return TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 单纯的将时间类型的字符串(这种格式:1597302318861,13位数),转换时间类型 |
| | | /// </summary> |
| | | /// <param name="timeText"></param> |
| | | /// <returns></returns> |
| | | public DateTime ConvertTextToTime(string timeText) |
| | | { |
| | | DateTime dtStart = new DateTime(1970, 1, 1); |
| | | long lTime = long.Parse(timeText + "0000"); |
| | | TimeSpan toNow = new TimeSpan(lTime); |
| | | return dtStart.Add(toNow); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 转换为日期文本(考虑中英文,返回格式:2021年9月1日(中文情况) Sept 1,2021(英文)) |
| | | /// </summary> |
| | | /// <param name="i_month">月</param> |
| | | /// <param name="i_day">日</param> |
| | | /// <param name="i_year">年(可以省略)</param> |
| | | /// <returns></returns> |
| | | public string ConvertDayText(int i_month, int i_day, int i_year = -1) |
| | | { |
| | | //中文 |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | string txt = i_month + Language.StringByID(StringId.month) + i_day + Language.StringByID(StringId.day); |
| | | if (i_year != -1) |
| | | { |
| | | txt = i_year + Language.StringByID(StringId.Years) + txt; |
| | | } |
| | | return txt; |
| | | } |
| | | //英文 |
| | | string yearText = i_year == -1 ? string.Empty : "," + i_year.ToString(); |
| | | if (i_month == 1) { return "Jan " + i_day + yearText; } |
| | | if (i_month == 2) { return "Feb " + i_day + yearText; } |
| | | if (i_month == 3) { return "Mar " + i_day + yearText; } |
| | | if (i_month == 4) { return "Apr " + i_day + yearText; } |
| | | if (i_month == 5) { return "May " + i_day + yearText; } |
| | | if (i_month == 6) { return "Jun " + i_day + yearText; } |
| | | if (i_month == 7) { return "Jul " + i_day + yearText; } |
| | | if (i_month == 8) { return "Aug " + i_day + yearText; } |
| | | if (i_month == 9) { return "Sept " + i_day + yearText; } |
| | | if (i_month == 10) { return "Oct " + i_day + yearText; } |
| | | if (i_month == 11) { return "Nov " + i_day + yearText; } |
| | | if (i_month == 12) { return "Dec " + i_day + yearText; } |
| | | return string.Empty; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取时间的翻译文本 |
| | | /// </summary> |
| | | /// <param name="second"></param> |
| | | /// <param name="hourText">小时的文本</param> |
| | | /// <param name="minuText">分的文本</param> |
| | | /// <param name="secondText">秒的文本</param> |
| | | /// <returns></returns> |
| | | public string GetTimeString(int second, string hourText, string minuText, string secondText) |
| | | { |
| | | if (second == 0) { return string.Empty; } |
| | | |
| | | string timeStr = string.Empty; |
| | | int hour = second / 3600; |
| | | int minu = second % 3600 / 60; |
| | | int sec = second % 60; |
| | | |
| | | //中文 |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | if (hour > 0) { timeStr += hour + hourText; } |
| | | if (minu > 0) { timeStr += minu + minuText; } |
| | | if (sec > 0) { timeStr += sec + secondText; } |
| | | } |
| | | //英文 |
| | | else |
| | | { |
| | | if (hour > 0) { timeStr += hour + "h"; } |
| | | if (minu > 0) { timeStr += minu + "min"; } |
| | | if (sec > 0) { timeStr += sec + "s"; } |
| | | } |
| | | return timeStr; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取月的简写文本(考虑中英文,返回格式:月(中文情况) Sept.(英文)) |
| | | /// </summary> |
| | | /// <param name="i_month">月</param> |
| | | /// <returns></returns> |
| | | public string GetMonthShortText(int i_month) |
| | | { |
| | | //中文 |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | return Language.StringByID(StringId.month); |
| | | } |
| | | //英文 |
| | | if (i_month == 1) { return "Jan."; } |
| | | if (i_month == 2) { return "Feb."; } |
| | | if (i_month == 3) { return "Mar."; } |
| | | if (i_month == 4) { return "Apr."; } |
| | | if (i_month == 5) { return "May."; } |
| | | if (i_month == 6) { return "Jun."; } |
| | | if (i_month == 7) { return "Jul."; } |
| | | if (i_month == 8) { return "Aug."; } |
| | | if (i_month == 9) { return "Sept."; } |
| | | if (i_month == 10) { return "Oct."; } |
| | | if (i_month == 11) { return "Nov."; } |
| | | if (i_month == 12) { return "Dec."; } |
| | | return string.Empty; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取小时的文本(中英文) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetHourText() |
| | | { |
| | | //中文 |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | //小时 |
| | | return Language.StringByID(StringId.h); |
| | | } |
| | | //英文 |
| | | return "h"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取分钟的文本(中英文) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetMinuteText() |
| | | { |
| | | //中文 |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | //分 |
| | | return Language.StringByID(StringId.m); |
| | | } |
| | | //英文 |
| | | return "min"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取分钟的文本(中英文) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetSecondText() |
| | | { |
| | | //中文 |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | //秒 |
| | | return Language.StringByID(StringId.s); |
| | | } |
| | | //英文 |
| | | return "s"; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 系统剪切板_________________________ |
| | | |
| | | /// <summary> |
| | | /// 将文本复制到系统的剪切板 |
| | | /// </summary> |
| | | /// <param name="i_text">需要复制进去的东西</param> |
| | | /// <param name="i_msg">复制成功之后,显示的文本,可以为null</param> |
| | | public void SetTextToShearPlate(string i_text, string i_msg) |
| | | { |
| | | #if __Android__ |
| | | var cm = (Android.Content.ClipboardManager)Application.Activity.GetSystemService(Android.Content.Context.ClipboardService); |
| | | // 将文本内容放到系统剪贴板里。 |
| | | cm.Text = i_text; |
| | | #endif |
| | | //显示tip消息 |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, i_msg); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 检测日期是否合法 |
| | | /// </summary> |
| | | /// <param name="i_year">年</param> |
| | | /// <param name="i_month">月</param> |
| | | /// <param name="i_day">日</param> |
| | | /// <returns></returns> |
| | | public bool CheckDateIsRight(int i_year, int i_month, int i_day) |
| | | { |
| | | if (i_year <= 0) { i_year = DateTime.Now.Year; } |
| | | |
| | | int two = DateTime.IsLeapYear(i_year) == true ? 29 : 28; |
| | | int[] arry = new int[] { 31, two, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
| | | |
| | | if (i_month < 1 || i_month > 12) { return false; } |
| | | |
| | | return i_day <= arry[i_month - 1]; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检测是否是纯数字 |
| | | /// </summary> |
| | | /// <param name="i_text"></param> |
| | | /// <returns></returns> |
| | | public bool CheckIsNumber(string i_text) |
| | | { |
| | | foreach (var c in i_text) |
| | | { |
| | | if (char.IsNumber(c) == false) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 从一堆文字中,获取这一堆文字里面数字字符串的最长长度 |
| | | /// </summary> |
| | | /// <param name="listText"></param> |
| | | /// <returns></returns> |
| | | public int GetNumberMaxLength(List<string> listText) |
| | | { |
| | | int maxLength = 0; |
| | | foreach (var text in listText) |
| | | { |
| | | string value = string.Empty; |
| | | foreach (var c in text) |
| | | { |
| | | if (char.IsNumber(c) == true) |
| | | { |
| | | //数字 |
| | | value += c.ToString(); |
| | | continue; |
| | | } |
| | | else if (value != string.Empty) |
| | | { |
| | | //判断数字长度 |
| | | if (maxLength <= value.Length) |
| | | { |
| | | maxLength = value.Length; |
| | | } |
| | | value = string.Empty; |
| | | } |
| | | } |
| | | //判断数字长度 |
| | | if (maxLength <= value.Length) |
| | | { |
| | | maxLength = value.Length; |
| | | } |
| | | } |
| | | return maxLength; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | try
|
| | | {
|
| | | var Myform = actionForm as EditorCommonForm;
|
| | | //重置左滑使能
|
| | | Myform.ScrollLeftEnabled = Myform.ScrollLeftEnabled;
|
| | | //触发界面再次激活的事件
|
| | | Myform.FormActionAgainEvent();
|
| | | }
|
| | |
| | | /// <param name="msg">信息</param>
|
| | | /// <param name="action">单击确认后执行的回调函数</param>
|
| | | /// <param name="buttonText">按钮的文本</param>
|
| | | /// <param name="buttonCacel">取消按钮的文本</param>
|
| | | /// <param name="i_waitTime">等待时间,单位为秒,设置确认按钮在多长时间后才能够点击</param>
|
| | | public void ShowMassage(ShowMsgType msgType, string msg, Action action = null, string buttonText = null, int i_waitTime = -1)
|
| | | public void ShowMassage(ShowMsgType msgType, string msg, Action action = null, string buttonText = null, string buttonCacel = null, int i_waitTime = -1)
|
| | | {
|
| | | //空对象时,不显示
|
| | | if (string.IsNullOrEmpty(msg))
|
| | |
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | var alert = new ShowMsgControl(msgType, msg, buttonText, null, i_waitTime);
|
| | | var alert = new ShowMsgControl(msgType, msg, buttonText, buttonCacel, i_waitTime);
|
| | | if (action != null)
|
| | | {
|
| | | alert.ConfirmClickEvent += () =>
|
| | |
| | | == false ? StringId.Administrators : StringId.Member |
| | | }; |
| | | userTypeView.AddChidren(btnUserTypeName); |
| | | btnUserTypeName.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var form = new DoorLockListPage(); |
| | | var listDevice = new System.Collections.Generic.List<Function>(); |
| | | listDevice.Add(new Function { name = "测试设备1", sid = "1111", spk = "door.sone" }); |
| | | listDevice.Add(new Function { name = "测试设备2", sid = "2222", spk = "door.sone" }); |
| | | listDevice.Add(new Function { name = "测试设备3", sid = "3333", spk = "door.sone" }); |
| | | listDevice.Add(new Function { name = "测试设备4", sid = "4444", spk = "door.sone" }); |
| | | listDevice.Add(new Function { name = "测试设备5", sid = "5555", spk = "door.sone" }); |
| | | listDevice.Add(new Function { name = "测试设备6", sid = "6666", spk = "door.sone" }); |
| | | form.AddForm(listDevice); |
| | | }; |
| | | #endregion |
| | | #region 住宅管理 |
| | | |
| | |
| | | Action backAction; |
| | | public AppUnlockGesturePage(string pw, Action action) |
| | | { |
| | | MainPage.BasePageView.ScrollEnabled = false; |
| | | bodyView = this; |
| | | oldPasswrod = pw; |
| | | backAction = action; |
| | |
| | | //Button btnSecurityBg; |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 设置门锁选项提示 |
| | | ///// </summary> |
| | | //Button btnDoorlockSelectionTip; |
| | | ///// <summary> |
| | | ///// 设置门锁选项选中图标 |
| | | ///// </summary> |
| | | //Button btnDoorlockSelectionIcon; |
| | | ///// <summary> |
| | | ///// 设置门锁选项背景 |
| | | ///// </summary> |
| | | //Button btnDoorlockBg; |
| | | /// <summary> |
| | | /// 设置门锁选项提示 |
| | | /// </summary> |
| | | Button btnDoorlockSelectionTip; |
| | | /// <summary> |
| | | /// 设置门锁选项选中图标 |
| | | /// </summary> |
| | | Button btnDoorlockSelectionIcon; |
| | | /// <summary> |
| | | /// 设置门锁选项背景 |
| | | /// </summary> |
| | | Button btnDoorlockBg; |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | |
| | | #region Doorlock |
| | | //optionView.AddChidren(new Button() { Width = Application.GetRealWidth(16) }); |
| | | optionView.AddChidren(new Button() { Width = Application.GetRealWidth(16) }); |
| | | |
| | | //FrameLayout doorlockDiv = new FrameLayout() |
| | | //{ |
| | | // Width = Application.GetRealWidth(94), |
| | | //}; |
| | | //optionView.AddChidren(doorlockDiv); |
| | | FrameLayout doorlockDiv = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(94), |
| | | }; |
| | | optionView.AddChidren(doorlockDiv); |
| | | |
| | | //btnDoorlockBg = new Button() |
| | | //{ |
| | | // Height = Application.GetRealWidth(174), |
| | | // UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/4.png", |
| | | // SelectedImagePath = "PersonalCenter/AppUnlockSetting/4On.png" |
| | | //}; |
| | | //doorlockDiv.AddChidren(btnDoorlockBg); |
| | | btnDoorlockBg = new Button() |
| | | { |
| | | Height = Application.GetRealWidth(174), |
| | | UnSelectedImagePath = "PersonalCenter/AppUnlockSetting/4.png", |
| | | SelectedImagePath = "PersonalCenter/AppUnlockSetting/4On.png" |
| | | }; |
| | | doorlockDiv.AddChidren(btnDoorlockBg); |
| | | |
| | | //btnDoorlockSelectionIcon = new Button() |
| | | //{ |
| | | // X = Application.GetRealWidth(5), |
| | | // Y = Application.GetRealWidth(174), |
| | | // Width = Application.GetRealWidth(30), |
| | | // Height = Application.GetRealWidth(30), |
| | | // UnSelectedImagePath = "Public/ChooseIcon.png", |
| | | // SelectedImagePath = "Public/ChooseOnIcon.png", |
| | | //}; |
| | | //doorlockDiv.AddChidren(btnDoorlockSelectionIcon); |
| | | btnDoorlockSelectionIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(5), |
| | | Y = Application.GetRealWidth(174), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = "Public/ChooseIcon.png", |
| | | SelectedImagePath = "Public/ChooseOnIcon.png", |
| | | }; |
| | | doorlockDiv.AddChidren(btnDoorlockSelectionIcon); |
| | | |
| | | //btnDoorlockSelectionTip = new Button() |
| | | //{ |
| | | // X = Application.GetRealWidth(30), |
| | | // Y = Application.GetRealWidth(174), |
| | | // Width = Application.GetRealWidth(74), |
| | | // Height = Application.GetRealWidth(30), |
| | | // TextID = StringId.RemoteUnlocking, |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // TextColor = CSS_Color.FirstLevelTitleColor, |
| | | // SelectedTextColor = CSS_Color.MainColor, |
| | | // TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel |
| | | //}; |
| | | //doorlockDiv.AddChidren(btnDoorlockSelectionTip); |
| | | btnDoorlockSelectionTip = new Button() |
| | | { |
| | | X = Application.GetRealWidth(30), |
| | | Y = Application.GetRealWidth(174), |
| | | Width = Application.GetRealWidth(74), |
| | | Height = Application.GetRealWidth(30), |
| | | TextID = StringId.RemoteUnlocking, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel |
| | | }; |
| | | doorlockDiv.AddChidren(btnDoorlockSelectionTip); |
| | | #endregion |
| | | #endregion |
| | | |
| | |
| | | btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = false; |
| | | #region F3阶段 |
| | | //btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = false; |
| | | //btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = false; |
| | | btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = false; |
| | | #endregion |
| | | |
| | | btnTipMsg.TextID = StringId.UnprotectedTipMsg; |
| | |
| | | //btnSecuritySelectionIcon.MouseUpEventHandler = eventHandler3; |
| | | //btnSecuritySelectionTip.MouseUpEventHandler = eventHandler3; |
| | | |
| | | //EventHandler<MouseEventArgs> eventHandler4 = (sender, e) => |
| | | //{ |
| | | // bool result = !btnDoorlockBg.IsSelected; |
| | | // if (!result) |
| | | // { |
| | | // //如果只剩远程开锁不能取消远程开锁 |
| | | // if (!CheckIfCanDeselect("3")) return; |
| | | // } |
| | | EventHandler<MouseEventArgs> eventHandler4 = (sender, e) => |
| | | { |
| | | bool result = !btnDoorlockBg.IsSelected; |
| | | if (!result) |
| | | { |
| | | //如果只剩远程开锁不能取消远程开锁 |
| | | if (!CheckIfCanDeselect("3")) return; |
| | | } |
| | | |
| | | // btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = result; |
| | | btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = result; |
| | | |
| | | // btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg); |
| | | // if (result) |
| | | // { |
| | | // btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; |
| | | // if (!UserInfo.Current.appUnlockPage.Contains("3")) |
| | | // { |
| | | // UserInfo.Current.appUnlockPage.Add("3"); |
| | | // if (UserInfo.Current.appUnlockPasswrod != "") |
| | | // UserInfo.Current.SaveUserInfo(); |
| | | // } |
| | | // unlockOptionView.Visible = true; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (UserInfo.Current.appUnlockPage.Contains("3")) |
| | | // { |
| | | // UserInfo.Current.appUnlockPage.Remove("3"); |
| | | // } |
| | | // if (UserInfo.Current.appUnlockPage.Count == 0) |
| | | // { |
| | | // btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; |
| | | // btnTipMsg.TextID = StringId.UnprotectedTipMsg; |
| | | // UserInfo.Current.appUnlockPasswrod = ""; |
| | | // unlockOptionView.Visible = false; |
| | | // refreshAction(); |
| | | // } |
| | | // UserInfo.Current.SaveUserInfo(); |
| | | // } |
| | | //}; |
| | | //btnDoorlockBg.MouseUpEventHandler = eventHandler4; |
| | | //btnDoorlockSelectionIcon.MouseUpEventHandler = eventHandler4; |
| | | //btnDoorlockSelectionTip.MouseUpEventHandler = eventHandler4; |
| | | btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg); |
| | | if (result) |
| | | { |
| | | btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; |
| | | if (!UserInfo.Current.appUnlockPage.Contains("3")) |
| | | { |
| | | UserInfo.Current.appUnlockPage.Add("3"); |
| | | if (UserInfo.Current.appUnlockPasswrod != "") |
| | | UserInfo.Current.SaveUserInfo(); |
| | | } |
| | | unlockOptionView.Visible = true; |
| | | } |
| | | else |
| | | { |
| | | if (UserInfo.Current.appUnlockPage.Contains("3")) |
| | | { |
| | | UserInfo.Current.appUnlockPage.Remove("3"); |
| | | } |
| | | if (UserInfo.Current.appUnlockPage.Count == 0) |
| | | { |
| | | btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; |
| | | btnTipMsg.TextID = StringId.UnprotectedTipMsg; |
| | | UserInfo.Current.appUnlockPasswrod = ""; |
| | | unlockOptionView.Visible = false; |
| | | refreshAction(); |
| | | } |
| | | UserInfo.Current.SaveUserInfo(); |
| | | } |
| | | }; |
| | | btnDoorlockBg.MouseUpEventHandler = eventHandler4; |
| | | btnDoorlockSelectionIcon.MouseUpEventHandler = eventHandler4; |
| | | btnDoorlockSelectionTip.MouseUpEventHandler = eventHandler4; |
| | | #endregion |
| | | } |
| | | |
| | |
| | | // btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true; |
| | | // btnTipMsg.Text = Language.StringByID(StringId.DefenseAndUndefenseTipMsg); |
| | | //} |
| | | //if (UserInfo.Current.appUnlockPage.Contains("3")) |
| | | //{ |
| | | // btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true; |
| | | // btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg); |
| | | //} |
| | | if (UserInfo.Current.appUnlockPage.Contains("3")) |
| | | { |
| | | btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true; |
| | | btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁常开自动化列表界面 |
| | | /// </summary> |
| | | public class DoorLockAlwaysOnListPage : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 上部Frame的容器控件 |
| | | /// </summary> |
| | | private FrameLayout frameTopBack = null; |
| | | /// <summary> |
| | | /// 下部Frame的容器控件 |
| | | /// </summary> |
| | | private FrameLayout frameBottomBack = null; |
| | | /// <summary> |
| | | /// 自动化列表控件 |
| | | /// </summary> |
| | | private VerticalListControl listView = null; |
| | | /// <summary> |
| | | /// 门锁信息 |
| | | /// </summary> |
| | | private DoorLockAlwayOnInfo doorLockInfo = new DoorLockAlwayOnInfo(); |
| | | /// <summary> |
| | | /// 门锁对象 |
| | | /// </summary> |
| | | private Function doorDevice = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | /// <param name="i_doorDevice">门锁对象</param> |
| | | public void ShowForm(Function i_doorDevice) |
| | | { |
| | | this.doorDevice = i_doorDevice; |
| | | |
| | | //常开 |
| | | base.SetTitleText(Language.StringByID(StringId.AlwaysOn)); |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | //初始化上部控件 |
| | | this.InitTopTopBackControl(); |
| | | |
| | | //初始化下部控件 |
| | | this.InitBottomBackControl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化上部控件_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化上部控件 |
| | | /// </summary> |
| | | private void InitTopTopBackControl() |
| | | { |
| | | if (this.frameTopBack == null || this.frameTopBack.Parent == null) |
| | | { |
| | | this.frameTopBack = new FrameLayout(); |
| | | frameTopBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | bodyFrameLayout.AddChidren(frameTopBack); |
| | | } |
| | | else |
| | | { |
| | | this.frameTopBack.RemoveAll(); |
| | | } |
| | | |
| | | //如果不处于常开模式 |
| | | if (this.doorLockInfo.IsAlwayOpen == false) |
| | | { |
| | | //锁的图片 |
| | | var btnPic = new PicViewControl(102, 102); |
| | | btnPic.Y = Application.GetRealHeight(28); |
| | | btnPic.Gravity = Gravity.CenterHorizontal; |
| | | btnPic.UnSelectedImagePath = "FunctionIcon/DoorLock/UnLockPictrue2.png"; |
| | | this.frameTopBack.AddChidren(btnPic); |
| | | btnPic.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.doorLockInfo.IsAlwayOpen = true; |
| | | //重新初始化上部控件 |
| | | this.InitTopTopBackControl(); |
| | | }; |
| | | |
| | | //时效性常开设置 |
| | | var rowSettion = new FrameRowControl(); |
| | | rowSettion.Y = btnPic.Bottom + Application.GetRealHeight(32); |
| | | this.frameTopBack.AddChidren(rowSettion); |
| | | rowSettion.AddLeftCaption(Language.StringByID(StringId.TimelyAlwaysOnSetting), 350); |
| | | rowSettion.AddRightArrow(); |
| | | rowSettion.AddBottomLine(); |
| | | rowSettion.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //设置常开模式后{0}您的门锁将处于打开状态{0}是否继续开启 |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.OpenAlwayOnConfirmMsg), () => |
| | | { |
| | | var form = new DoorLockExpireTimeSettionPage(); |
| | | form.ShowForm(); |
| | | form.FinishEvent += (hour) => |
| | | { |
| | | //已开启 |
| | | //HdlMessageLogic.Current.ShowMassage(ShowMsgType.ConfirmSuccess, Language.StringByID(StringId.AlreadyOpened), () => |
| | | //{ |
| | | |
| | | //}); |
| | | //常开模式关闭设置失效,请重试 |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.ConfirmFail, Language.StringByID(StringId.AlwayOnFailTimeSettionFailMsg), () => |
| | | { |
| | | }); |
| | | }; |
| | | |
| | | }, Language.StringByID(StringId.ConfirmOpen)); |
| | | }; |
| | | |
| | | //变更容器高度 |
| | | this.frameTopBack.Height = rowSettion.Bottom + Application.GetRealHeight(12); |
| | | } |
| | | //如果处于常开模式 |
| | | else |
| | | { |
| | | //锁的图片 |
| | | var btnPic = new PicViewControl(102, 102); |
| | | btnPic.Y = Application.GetRealHeight(28); |
| | | btnPic.Gravity = Gravity.CenterHorizontal; |
| | | btnPic.UnSelectedImagePath = "FunctionIcon/DoorLock/UnLockPictrue1.png"; |
| | | this.frameTopBack.AddChidren(btnPic); |
| | | |
| | | //关闭按钮 |
| | | var btnClose = new BottomClickButton(220); |
| | | btnClose.Y = btnPic.Bottom + Application.GetRealHeight(28); |
| | | btnClose.TextID = StringId.Close; |
| | | this.frameTopBack.AddChidren(btnClose); |
| | | btnClose.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.doorLockInfo.IsAlwayOpen = false; |
| | | //重新初始化上部控件 |
| | | this.InitTopTopBackControl(); |
| | | }; |
| | | |
| | | //常开模式将于{12.31 14:59}关闭 |
| | | var listMsg = Language.StringByID(StringId.AlwaysOnWillCloseOnTime).Split(new string[] { "{0}" }, StringSplitOptions.None); |
| | | int widthCount = 0; |
| | | //常开模式将于 |
| | | var btnMsg1 = new NormalViewControl(100, 20, true); |
| | | btnMsg1.Y = btnClose.Bottom + Application.GetRealHeight(32); |
| | | btnMsg1.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnMsg1.Text = listMsg[0]; |
| | | btnMsg1.Width = btnMsg1.GetRealWidthByText(); |
| | | this.frameTopBack.AddChidren(btnMsg1); |
| | | widthCount += btnMsg1.Width; |
| | | //时间(12.31 14:59) |
| | | var startTime = this.doorLockInfo.StartTime.AddHours(this.doorLockInfo.AlwayOpenHour); |
| | | var btnMsgTime = new NormalViewControl(100, 20, true); |
| | | btnMsgTime.Y = btnMsg1.Y; |
| | | btnMsgTime.TextColor = CSS_Color.AuxiliaryColor2; |
| | | btnMsgTime.Text = HdlCommonLogic.Current.ConvertDayText(startTime.Month, startTime.Day, startTime.Year) + " " + startTime.ToString("HH:mm"); |
| | | btnMsgTime.Width = btnMsgTime.GetRealWidthByText(); |
| | | this.frameTopBack.AddChidren(btnMsgTime); |
| | | widthCount += btnMsgTime.Width; |
| | | |
| | | NormalViewControl btnMsg2 = null; |
| | | if (listMsg.Length > 1) |
| | | { |
| | | //关闭 |
| | | btnMsg2 = new NormalViewControl(100, 20, true); |
| | | btnMsg2.Y = btnMsg1.Y; |
| | | btnMsg2.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnMsg2.Text = listMsg[1]; |
| | | btnMsg2.Width = btnMsg2.GetRealWidthByText(); |
| | | this.frameTopBack.AddChidren(btnMsg2); |
| | | widthCount += btnMsg2.Width; |
| | | } |
| | | //让这三个东西居中 |
| | | int defultXX = (this.frameTopBack.Width - widthCount) / 2; |
| | | btnMsg1.X = defultXX; |
| | | btnMsgTime.X = btnMsg1.Right; |
| | | if (btnMsg2 != null) |
| | | { |
| | | btnMsg2.X = btnMsgTime.Right; |
| | | } |
| | | |
| | | //变更容器高度 |
| | | this.frameTopBack.Height = btnMsgTime.Bottom + Application.GetRealHeight(16); |
| | | } |
| | | //刷新下部Frame控件的坐标和高度 |
| | | this.RefreshBottomFrameHeightAndLocation(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化下部控件_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化下部控件 |
| | | /// </summary> |
| | | private void InitBottomBackControl() |
| | | { |
| | | if (this.frameBottomBack == null || this.frameBottomBack.Parent == null) |
| | | { |
| | | this.frameBottomBack = new FrameLayout(); |
| | | frameBottomBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | bodyFrameLayout.AddChidren(frameBottomBack); |
| | | //常开自动化 |
| | | var rowSettion = new FrameRowControl(); |
| | | rowSettion.Y = Application.GetRealHeight(6); |
| | | frameBottomBack.AddChidren(rowSettion); |
| | | var btnCation = rowSettion.AddLeftCaption(Language.StringByID(StringId.AutomationAlwaysOn), 300); |
| | | btnCation.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnCation.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnCation.IsBold = true; |
| | | //添加图标 |
| | | var btnAddIcon = rowSettion.AddMostRightEmptyIcon(38, 38); |
| | | btnAddIcon.UnSelectedImagePath = "Public/AddIcon.png"; |
| | | btnAddIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var form = new DoorLockAlwaysOnManagerPage(); |
| | | form.AddForm(new object[] { null }); |
| | | }; |
| | | |
| | | //列表控件 |
| | | this.listView = new VerticalListControl(); |
| | | frameBottomBack.AddChidren(listView); |
| | | } |
| | | else |
| | | { |
| | | this.frameBottomBack.RemoveAll(); |
| | | this.listView.RemoveAll(); |
| | | } |
| | | //刷新下部Frame控件的坐标和高度 |
| | | this.RefreshBottomFrameHeightAndLocation(); |
| | | |
| | | //测试 |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | //添加自动化条件控件 |
| | | this.AddAutomationControl(new AlwayOnAutomationInfo()); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 添加自动化条件控件_________________ |
| | | |
| | | /// <summary> |
| | | /// 添加自动化条件控件 |
| | | /// </summary> |
| | | /// <param name="i_info">自动化信息</param> |
| | | private void AddAutomationControl(AlwayOnAutomationInfo i_info) |
| | | { |
| | | //容器控件 |
| | | var rowBack = new RowLayout(); |
| | | rowBack.LineColor = CSS_Color.viewTranslucence; |
| | | rowBack.SubViewWidth = Application.GetRealWidth(80); |
| | | rowBack.Height = Application.GetRealHeight(100); |
| | | this.listView.AddChidren(rowBack); |
| | | |
| | | //消息 |
| | | var btnMsg = new NormalViewControl(rowBack.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(20), false); |
| | | btnMsg.X = HdlControlResourse.XXLeft; |
| | | btnMsg.Y = Application.GetRealHeight(10); |
| | | btnMsg.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | if (i_info.IsOpenAlwayOn == true) |
| | | { |
| | | //9:00 - 打开常开模式 |
| | | btnMsg.Text = i_info.Hour + ":" + i_info.Minute.ToString().PadLeft(2, '0') + " - " + Language.StringByID(StringId.OpenAlwaysOnModel); |
| | | } |
| | | else |
| | | { |
| | | //9:00 - 关闭常开模式 |
| | | btnMsg.Text = i_info.Hour + ":" + i_info.Minute.ToString().PadLeft(2, '0') + " - " + Language.StringByID(StringId.CloseAlwaysOnModel); |
| | | } |
| | | rowBack.AddChidren(btnMsg); |
| | | |
| | | //周期 |
| | | var btnTimeLoop = new NormalViewControl(rowBack.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(18), false); |
| | | btnTimeLoop.X = btnMsg.X; |
| | | btnTimeLoop.Y = btnMsg.Bottom + Application.GetRealHeight(4); |
| | | btnTimeLoop.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnTimeLoop.TextColor = CSS_Color.PromptingColor1; |
| | | btnTimeLoop.Text = "周一 - 周五"; |
| | | rowBack.AddChidren(btnTimeLoop); |
| | | |
| | | //图标行控件 |
| | | var rowIcon = new FrameRowControl(); |
| | | rowIcon.Gravity = Gravity.BottomCenter; |
| | | rowBack.AddChidren(rowIcon); |
| | | |
| | | //先画底线 |
| | | rowIcon.AddBottomLine(); |
| | | |
| | | //固定的三个图标 |
| | | var btnIcon1 = rowIcon.AddLeftIcon(28, "Phone/LogicIcon/selectTheTime.png"); |
| | | var btnIcon2 = rowIcon.AddLeftIcon(20, "Phone/LogicIcon/link.png"); |
| | | btnIcon2.X = btnIcon1.Right + Application.GetRealWidth(8); |
| | | var btnIcon3 = rowIcon.AddLeftIcon(28, "FunctionIcon/DoorLock/NormallyOpenIcon3.png"); |
| | | btnIcon3.X = btnIcon2.Right + Application.GetRealWidth(8); |
| | | |
| | | //开关 |
| | | var btnSwitch = rowIcon.AddMostRightSwitchIcon(); |
| | | btnSwitch.ButtonClickEvent += (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | }; |
| | | |
| | | //编辑 |
| | | var btnEditor = new NormalViewControl(rowBack.SubViewWidth, rowBack.Height, false); |
| | | btnEditor.TextAlignment = TextAlignment.Center; |
| | | btnEditor.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnEditor.TextColor = CSS_Color.MainBackgroundColor; |
| | | btnEditor.BackgroundColor = CSS_Color.AuxiliaryColor1; |
| | | btnEditor.TextID = StringId.Edit; |
| | | rowBack.AddRightView(btnEditor); |
| | | btnEditor.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //还原 |
| | | rowBack.HideRightMenu(); |
| | | var form = new DoorLockAlwaysOnManagerPage(); |
| | | form.AddForm(new object[] { i_info }); |
| | | }; |
| | | //删除 |
| | | var btnDelete = new NormalViewControl(rowBack.SubViewWidth, rowBack.Height, false); |
| | | btnDelete.TextAlignment = TextAlignment.Center; |
| | | btnDelete.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnDelete.TextColor = CSS_Color.MainBackgroundColor; |
| | | btnDelete.BackgroundColor = CSS_Color.AuxiliaryColor2; |
| | | btnDelete.TextID = StringId.Del; |
| | | rowBack.AddRightView(btnDelete); |
| | | btnDelete.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //是否要删除自动化? |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.delAutomation), () => |
| | | { |
| | | rowBack.RemoveFromParent(); |
| | | }); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新下部Frame控件的坐标和高度 |
| | | /// </summary> |
| | | private void RefreshBottomFrameHeightAndLocation() |
| | | { |
| | | if (this.frameBottomBack != null) |
| | | { |
| | | this.frameBottomBack.Y = this.frameTopBack.Bottom + Application.GetRealHeight(8); |
| | | this.frameBottomBack.Height = bodyFrameLayout.Height - this.frameBottomBack.Y; |
| | | } |
| | | if (this.listView != null) |
| | | { |
| | | //这个Y轴固定 |
| | | this.listView.Y = Application.GetRealHeight(58); |
| | | this.listView.Height = this.frameBottomBack.Height - this.listView.Y; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 界面关闭___________________________ |
| | | |
| | | /// <summary> |
| | | /// 界面关闭 |
| | | /// </summary> |
| | | public override void CloseFormBefore() |
| | | { |
| | | base.CloseFormBefore(); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁常开自动化编辑界面 |
| | | /// </summary> |
| | | public class DoorLockAlwaysOnManagerPage : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 常开自动化信息 |
| | | /// </summary> |
| | | private AlwayOnAutomationInfo automationInfo = null; |
| | | /// <summary> |
| | | /// 一些文本 |
| | | /// </summary> |
| | | private Dictionary<string, string> dicText = new Dictionary<string, string>(); |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | public void ShowForm(AlwayOnAutomationInfo info) |
| | | { |
| | | this.automationInfo = info; |
| | | if (info == null) |
| | | { |
| | | this.automationInfo = new AlwayOnAutomationInfo(); |
| | | //新建自动化 |
| | | base.SetTitleText(Language.StringByID(StringId.newAutomation)); |
| | | } |
| | | else |
| | | { |
| | | //编辑自动化 |
| | | base.SetTitleText(Language.StringByID(StringId.editAutomation)); |
| | | } |
| | | |
| | | this.dicText["周1"] = Language.StringByID(StringId.monday); |
| | | this.dicText["周2"] = Language.StringByID(StringId.tuesday); |
| | | this.dicText["周3"] = Language.StringByID(StringId.wednesday); |
| | | this.dicText["周4"] = Language.StringByID(StringId.thursday); |
| | | this.dicText["周5"] = Language.StringByID(StringId.friday); |
| | | this.dicText["周6"] = Language.StringByID(StringId.saturday); |
| | | this.dicText["周7"] = Language.StringByID(StringId.sunday); |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | //初始化条件控件 |
| | | this.InitConditionControl(); |
| | | //初始化目标控件 |
| | | this.InitTargetControl(); |
| | | //初始化循环方式控件 |
| | | this.InitLoopControl(); |
| | | |
| | | //确认按钮 |
| | | var btnSave = this.AddBottomClickButton(Language.StringByID(StringId.Confirm)); |
| | | btnSave.ButtonClickEvent += (sender, e) => |
| | | { |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化条件控件_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化条件控件 |
| | | /// </summary> |
| | | private void InitConditionControl() |
| | | { |
| | | //如果 |
| | | var btnIf = new NormalViewControl(300, 22, true); |
| | | btnIf.X = HdlControlResourse.XXLeft; |
| | | btnIf.Y = Application.GetRealHeight(12); |
| | | btnIf.TextID = StringId.ifCondition; |
| | | btnIf.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnIf.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnIf.IsBold = true; |
| | | bodyFrameLayout.AddChidren(btnIf); |
| | | |
| | | //白色背景容器 |
| | | var frameBack = new FrameLayout(); |
| | | frameBack.Y = btnIf.Bottom + Application.GetRealHeight(12); |
| | | frameBack.Width = Application.GetRealWidth(343); |
| | | frameBack.Height = Application.GetRealHeight(88); |
| | | frameBack.Gravity = Gravity.CenterHorizontal; |
| | | frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | frameBack.Radius = (uint)Application.GetRealWidth(12); |
| | | bodyFrameLayout.AddChidren(frameBack); |
| | | |
| | | //条件 |
| | | var rowConditon = new FrameRowControl(); |
| | | rowConditon.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; |
| | | rowConditon.Width = frameBack.Width; |
| | | frameBack.AddChidren(rowConditon); |
| | | var btnConditon = rowConditon.AddLeftCaption(Language.StringByID(StringId.Condtion), 300); |
| | | btnConditon.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | //底线 |
| | | rowConditon.AddBottomLine(); |
| | | |
| | | //时刻 |
| | | var rowTime = new FrameRowControl(); |
| | | rowTime.Y = rowConditon.Bottom; |
| | | rowTime.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; |
| | | rowTime.Width = frameBack.Width; |
| | | frameBack.AddChidren(rowTime); |
| | | rowTime.AddLeftIcon(28, "LogicIcon/time.png"); |
| | | var btnTime = rowTime.AddLeftCaption(Language.StringByID(StringId.hour), 300); |
| | | btnTime.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | rowTime.AddRightArrow(); |
| | | var btnValue = rowTime.AddMostRightView(this.automationInfo.Hour + ":" + this.automationInfo.Minute.ToString().PadLeft(2, '0'), 80); |
| | | rowTime.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //时间选择弹窗 |
| | | var form = new BottomTimeSelectControl(); |
| | | form.InitControl(this.automationInfo.Hour, this.automationInfo.Minute); |
| | | form.FinishEvent += (div, selectHour, selectMin) => |
| | | { |
| | | if (div != 1) { return; } |
| | | this.automationInfo.Hour = selectHour; |
| | | this.automationInfo.Minute = selectMin; |
| | | btnValue.Text = this.automationInfo.Hour + ":" + this.automationInfo.Minute.ToString().PadLeft(2, '0'); |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化目标控件_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化目标控件 |
| | | /// </summary> |
| | | private void InitTargetControl() |
| | | { |
| | | //就执行 |
| | | var btnExecuted = new NormalViewControl(300, 22, true); |
| | | btnExecuted.X = HdlControlResourse.XXLeft; |
| | | btnExecuted.Y = Application.GetRealHeight(154); |
| | | btnExecuted.TextID = StringId.isExecuted; |
| | | btnExecuted.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnExecuted.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnExecuted.IsBold = true; |
| | | bodyFrameLayout.AddChidren(btnExecuted); |
| | | |
| | | //白色背景容器 |
| | | var frameBack = new FrameLayout(); |
| | | frameBack.Y = btnExecuted.Bottom + Application.GetRealHeight(12); |
| | | frameBack.Width = Application.GetRealWidth(343); |
| | | frameBack.Height = Application.GetRealHeight(88); |
| | | frameBack.Gravity = Gravity.CenterHorizontal; |
| | | frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | frameBack.Radius = (uint)Application.GetRealWidth(12); |
| | | bodyFrameLayout.AddChidren(frameBack); |
| | | |
| | | //动作行控件 |
| | | var rowAction = new FrameRowControl(); |
| | | rowAction.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; |
| | | rowAction.Width = frameBack.Width; |
| | | frameBack.AddChidren(rowAction); |
| | | //动作 |
| | | var btnAction = rowAction.AddLeftCaption(Language.StringByID(StringId.Action), 300); |
| | | btnAction.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | //底线 |
| | | rowAction.AddBottomLine(); |
| | | |
| | | //常开模式行控件 |
| | | var rowModel = new FrameRowControl(); |
| | | rowModel.Y = rowAction.Bottom; |
| | | rowModel.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; |
| | | rowModel.Width = frameBack.Width; |
| | | frameBack.AddChidren(rowModel); |
| | | //图标 |
| | | rowModel.AddLeftIcon(28, "FunctionIcon/DoorLock/NormallyOpenIcon2.png"); |
| | | //常开模式 |
| | | var btnAlwayOn = rowModel.AddLeftCaption(Language.StringByID(StringId.AlwaysOnModel), 300); |
| | | btnAlwayOn.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | //右箭头 |
| | | rowModel.AddRightArrow(); |
| | | //值 |
| | | var btnValue = rowModel.AddMostRightView(this.automationInfo.IsOpenAlwayOn == true ? |
| | | Language.StringByID(StringId.kaiqi) : Language.StringByID(StringId.Close), 80); |
| | | |
| | | rowModel.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //选择弹窗 |
| | | var form = new BottomMenuSelectControl(2); |
| | | //开启 |
| | | form.AddMenu(Language.StringByID(StringId.kaiqi), () => |
| | | { |
| | | this.automationInfo.IsOpenAlwayOn = true; |
| | | btnValue.Text = Language.StringByID(StringId.kaiqi); |
| | | }); |
| | | //关闭 |
| | | form.AddMenu(Language.StringByID(StringId.Close), () => |
| | | { |
| | | this.automationInfo.IsOpenAlwayOn = false; |
| | | btnValue.Text = Language.StringByID(StringId.Close); |
| | | },CSS_Color.PromptingColor1); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化循环方式控件_________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化循环方式控件 |
| | | /// </summary> |
| | | private void InitLoopControl() |
| | | { |
| | | //循环方式 |
| | | var btnloop = new NormalViewControl(300, 22, true); |
| | | btnloop.X = HdlControlResourse.XXLeft; |
| | | btnloop.Y = Application.GetRealHeight(296); |
| | | btnloop.TextID = StringId.cyclic; |
| | | btnloop.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnloop.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnloop.IsBold = true; |
| | | bodyFrameLayout.AddChidren(btnloop); |
| | | |
| | | //周期的白色背景容器 |
| | | var frameDayBack = new FrameLayout(); |
| | | frameDayBack.Y = btnloop.Bottom + Application.GetRealHeight(12); |
| | | frameDayBack.Width = Application.GetRealWidth(343); |
| | | frameDayBack.Height = Application.GetRealHeight(50); |
| | | frameDayBack.Gravity = Gravity.CenterHorizontal; |
| | | frameDayBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | frameDayBack.Radius = (uint)Application.GetRealWidth(12); |
| | | bodyFrameLayout.AddChidren(frameDayBack); |
| | | |
| | | //周期行控件 |
| | | var rowLoop = new FrameRowControl(); |
| | | rowLoop.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; |
| | | rowLoop.Width = frameDayBack.Width; |
| | | rowLoop.Height = Application.GetRealHeight(50); |
| | | frameDayBack.AddChidren(rowLoop); |
| | | //周期 |
| | | var cycleText = this.GetLoopCondtionText(); |
| | | var btnCycle = rowLoop.AddLeftCaption(cycleText, 270); |
| | | btnCycle.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnCycle.IsMoreLines = false;//让它不换行了,不然有点难看 |
| | | //右箭头 |
| | | rowLoop.AddRightArrow(); |
| | | rowLoop.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //显示周期循环配置窗口 |
| | | this.ShowLoopMethordSettionDialog(btnCycle); |
| | | }; |
| | | |
| | | //推送的白色背景容器 |
| | | var framePushBack = new FrameLayout(); |
| | | framePushBack.Y = frameDayBack.Bottom + Application.GetRealHeight(8); |
| | | framePushBack.Width = Application.GetRealWidth(343); |
| | | framePushBack.Height = Application.GetRealHeight(100); |
| | | framePushBack.Gravity = Gravity.CenterHorizontal; |
| | | framePushBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | framePushBack.Radius = (uint)Application.GetRealWidth(12); |
| | | bodyFrameLayout.AddChidren(framePushBack); |
| | | |
| | | //推送行控件 |
| | | var rowPush = new FrameRowControl(); |
| | | rowPush.Width = framePushBack.Width; |
| | | rowPush.Height = Application.GetRealHeight(50); |
| | | rowPush.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; |
| | | framePushBack.AddChidren(rowPush); |
| | | //执行推送 |
| | | var btnPush = rowPush.AddLeftCaption(Language.StringByID(StringId.push), 300); |
| | | btnPush.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | //底线 |
| | | rowPush.AddBottomLine(); |
| | | //推送的开关按钮 |
| | | var btnPushSwitch = rowPush.AddMostRightSwitchIcon(); |
| | | btnPushSwitch.ButtonClickEvent += (sender, e) => |
| | | { |
| | | btnPushSwitch.IsSelected = !btnPushSwitch.IsSelected; |
| | | }; |
| | | |
| | | //发送通知行控件 |
| | | var rowNotice = new FrameRowControl(); |
| | | rowNotice.Y = rowPush.Bottom; |
| | | rowNotice.Width = framePushBack.Width; |
| | | rowNotice.Height = Application.GetRealHeight(50); |
| | | rowNotice.LeftOffset = Application.GetRealWidth(12) - HdlControlResourse.XXLeft; |
| | | framePushBack.AddChidren(rowNotice); |
| | | //发送通知 |
| | | var btnNotice = rowNotice.AddLeftCaption(Language.StringByID(StringId.notification), 300); |
| | | btnNotice.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | //右箭头 |
| | | rowNotice.AddRightArrow(); |
| | | rowNotice.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var form = new UI2.Intelligence.Automation.InputPushText(); |
| | | MainPage.BasePageView.AddChidren(form); |
| | | form.Show(this.automationInfo.PushSettion); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | form.action += (pushInfo) => |
| | | { |
| | | //赋值 |
| | | this.automationInfo.PushSettion = pushInfo; |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 显示周期循环配置窗口_______________ |
| | | |
| | | /// <summary> |
| | | /// 显示周期循环配置窗口 |
| | | /// </summary> |
| | | private void ShowLoopMethordSettionDialog(NormalViewControl btnCycle) |
| | | { |
| | | //之前选择的控件 |
| | | NormalViewControl btnOldView = null; |
| | | |
| | | var form = new BottomItemEditorControl(4, Language.StringByID(StringId.cyclic)); |
| | | form.ClickConfirmClose = false; |
| | | //执行一次 |
| | | form.AddRowMenu(Language.StringByID(StringId.performA), string.Empty, (btnView, btnValue) => |
| | | { |
| | | this.automationInfo.LoopDiv = 1; |
| | | if (btnOldView != null) |
| | | { |
| | | //还原颜色 |
| | | btnOldView.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | } |
| | | //变更颜色 |
| | | btnView.TextColor = CSS_Color.textConfirmColor; |
| | | btnOldView = btnView; |
| | | //变更显示文本 |
| | | btnCycle.Text = this.GetLoopCondtionText(); |
| | | |
| | | }, false); |
| | | |
| | | //每天 |
| | | form.AddRowMenu(Language.StringByID(StringId.days), string.Empty, (btnView, btnValue) => |
| | | { |
| | | this.automationInfo.LoopDiv = 2; |
| | | if (btnOldView != null) |
| | | { |
| | | //还原颜色 |
| | | btnOldView.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | } |
| | | //变更颜色 |
| | | btnView.TextColor = CSS_Color.textConfirmColor; |
| | | btnOldView = btnView; |
| | | //变更显示文本 |
| | | btnCycle.Text = this.GetLoopCondtionText(); |
| | | |
| | | }, false); |
| | | |
| | | //每周 |
| | | form.AddRowMenu(Language.StringByID(StringId.weekly), string.Empty, (btnView, btnValue) => |
| | | { |
| | | //关闭弹窗,显示周期循环(星期)的配置窗口 |
| | | form.Close(); |
| | | this.ShowLoopMethordWeekDialog(btnCycle); |
| | | }); |
| | | |
| | | //每月 |
| | | form.AddRowMenu(Language.StringByID(StringId.monthly), string.Empty, (btnView, btnValue) => |
| | | { |
| | | //关闭弹窗,显示周期循环(月份)的配置窗口 |
| | | form.Close(); |
| | | this.ShowLoopMethordMonthDialog(btnCycle); |
| | | }); |
| | | |
| | | form.FinishEvent += (div) => |
| | | { |
| | | //当点击了确认时,如果还没选择,则无反应 |
| | | if (div != 1 || btnOldView == null) { return; } |
| | | |
| | | form.Close(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示周期循环(星期)的配置窗口 |
| | | /// </summary> |
| | | private void ShowLoopMethordWeekDialog(NormalViewControl btnCycle) |
| | | { |
| | | //星期一到星期日 |
| | | var listText = new List<string>(); |
| | | listText.Add(this.dicText["周1"]); |
| | | listText.Add(this.dicText["周2"]); |
| | | listText.Add(this.dicText["周3"]); |
| | | listText.Add(this.dicText["周4"]); |
| | | listText.Add(this.dicText["周5"]); |
| | | listText.Add(this.dicText["周6"]); |
| | | listText.Add(this.dicText["周7"]); |
| | | |
| | | var listSelect = new List<int>(); |
| | | if (this.automationInfo.LoopDiv == 3) |
| | | { |
| | | //之前选择的是这个区分才能有默认选择 |
| | | foreach (var value in this.automationInfo.ListLoopValue) |
| | | { |
| | | //默认选择 |
| | | listSelect.Add(value - 1); |
| | | } |
| | | } |
| | | |
| | | var form = new BottomItemSelectControl(7, Language.StringByID(StringId.cyclic)); |
| | | form.AddRowMenu(listText, listSelect); |
| | | form.FinishEvent += (div, listIndex) => |
| | | { |
| | | if (div == 0) |
| | | { |
| | | //如果点击了取消,则调起 周期循环配置窗口 |
| | | this.ShowLoopMethordSettionDialog(btnCycle); |
| | | return; |
| | | } |
| | | //更改缓存 |
| | | this.automationInfo.LoopDiv = 3; |
| | | this.automationInfo.ListLoopValue = new List<int>(); |
| | | |
| | | foreach (var index in listIndex) |
| | | { |
| | | this.automationInfo.ListLoopValue.Add(index + 1); |
| | | } |
| | | //变更显示文本 |
| | | btnCycle.Text = this.GetLoopCondtionText(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示周期循环(月份)的配置窗口 |
| | | /// </summary> |
| | | private void ShowLoopMethordMonthDialog(NormalViewControl btnCycle) |
| | | { |
| | | var listSelect = new List<int>(); |
| | | if (this.automationInfo.LoopDiv == 4) |
| | | { |
| | | //之前选择的是这个区分才能有默认选择 |
| | | foreach (var value in this.automationInfo.ListLoopValue) |
| | | { |
| | | //默认选择 |
| | | listSelect.Add(value); |
| | | } |
| | | } |
| | | |
| | | var form = new BottomSomeDaySelectControl(Language.StringByID(StringId.monthly)); |
| | | form.InitControl(listSelect); |
| | | form.FinishEvent += (div, listIndex) => |
| | | { |
| | | if (div == 0) |
| | | { |
| | | //如果点击了取消,则调起 周期循环配置窗口 |
| | | this.ShowLoopMethordSettionDialog(btnCycle); |
| | | return; |
| | | } |
| | | //更改缓存 |
| | | this.automationInfo.LoopDiv = 4; |
| | | this.automationInfo.ListLoopValue = new List<int>(); |
| | | |
| | | foreach (var day in listIndex) |
| | | { |
| | | this.automationInfo.ListLoopValue.Add(day); |
| | | } |
| | | //变更显示文本 |
| | | btnCycle.Text = this.GetLoopCondtionText(); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 获取循环条件的翻译文本 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private string GetLoopCondtionText() |
| | | { |
| | | //执行一次 |
| | | if (this.automationInfo.LoopDiv == 1) |
| | | { |
| | | return Language.StringByID(StringId.performA); |
| | | } |
| | | //每天 |
| | | else if (this.automationInfo.LoopDiv == 2) |
| | | { |
| | | return Language.StringByID(StringId.days); |
| | | } |
| | | //每周 |
| | | else if (this.automationInfo.LoopDiv == 3) |
| | | { |
| | | var textValue = string.Empty; |
| | | foreach (var weekValue in this.automationInfo.ListLoopValue) |
| | | { |
| | | textValue += this.dicText["周" + weekValue] + ","; |
| | | } |
| | | //去掉最后的逗号 |
| | | return textValue.Substring(0, textValue.Length - 1); |
| | | } |
| | | //每月 |
| | | else if (this.automationInfo.LoopDiv == 4) |
| | | { |
| | | var textValue = Language.StringByID(StringId.monthly) + " "; |
| | | foreach (var day in this.automationInfo.ListLoopValue) |
| | | { |
| | | textValue += day.ToString() + ","; |
| | | } |
| | | //去掉最后的逗号 |
| | | return textValue.Substring(0, textValue.Length - 1); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁常开模式失效时间设置界面(不需要添加到父控件) |
| | | /// </summary> |
| | | public class DoorLockExpireTimeSettionPage |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 结束事件(参数为,输入的小时) |
| | | /// </summary> |
| | | public Action<int> FinishEvent = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 界面显示 |
| | | /// </summary> |
| | | public void ShowForm() |
| | | { |
| | | var dialogForm = new Dialog(); |
| | | dialogForm.BackgroundColor = CSS_Color.DialogTransparentColor1; |
| | | //主控件 |
| | | var frameMain = new NormalFrameLayout(); |
| | | dialogForm.AddChidren(frameMain); |
| | | dialogForm.Show(); |
| | | frameMain.ButtonClickEvent += (sender, e) => |
| | | { |
| | | dialogForm.Close(); |
| | | this.FinishEvent = null; |
| | | }; |
| | | |
| | | //中间区域 |
| | | var frameCenter = new NormalFrameLayout(); |
| | | frameCenter.Y = Application.GetRealHeight(239); |
| | | frameCenter.Gravity = Gravity.CenterHorizontal; |
| | | frameCenter.Width = Application.GetRealWidth(270); |
| | | frameCenter.Height = Application.GetRealHeight(172); |
| | | frameCenter.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | frameCenter.BorderColor = 0x00000000; |
| | | frameCenter.BorderWidth = 0; |
| | | frameCenter.Radius = (uint)Application.GetMinRealAverage(10); |
| | | frameMain.AddChidren(frameCenter); |
| | | |
| | | //失效设置 |
| | | var btnTitle = new NormalViewControl(frameCenter.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(22), false); |
| | | btnTitle.Y = Application.GetRealHeight(20); |
| | | btnTitle.Gravity = Gravity.CenterHorizontal; |
| | | btnTitle.TextColor = CSS_Color.MainColor; |
| | | btnTitle.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnTitle.TextAlignment = TextAlignment.Center; |
| | | btnTitle.IsBold = true; |
| | | btnTitle.Text = Language.StringByID(StringId.FailTimeSeetion); |
| | | frameCenter.AddChidren(btnTitle); |
| | | |
| | | //常开模式将于{0}小时后失效 |
| | | string[] strArryMsg = Language.StringByID(StringId.AlwayOnWillCloseAtTimeMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); |
| | | |
| | | //常开模式将于 |
| | | var btnMsg1 = new NormalViewControl(Application.GetRealWidth(76), Application.GetRealHeight(32), false); |
| | | btnMsg1.X = Application.GetRealWidth(20); |
| | | btnMsg1.Y = btnTitle.Bottom + Application.GetRealHeight(20); |
| | | btnMsg1.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnMsg1.IsMoreLines = true; |
| | | btnMsg1.Text = strArryMsg[0].Trim(); |
| | | frameCenter.AddChidren(btnMsg1); |
| | | |
| | | //失效时间的背景容器 |
| | | var frameTime = new FrameLayout(); |
| | | frameTime.X = btnMsg1.Right + Application.GetRealWidth(12); |
| | | frameTime.Y = btnMsg1.Y; |
| | | frameTime.Width = Application.GetRealWidth(62); |
| | | frameTime.Height = Application.GetRealHeight(32); |
| | | frameTime.Radius = (uint)Application.GetRealWidth(4); |
| | | frameTime.BackgroundColor = CSS_Color.BackgroundColor; |
| | | frameCenter.AddChidren(frameTime); |
| | | //失效时间输入控件 |
| | | var txtInput = new TextInputControl(frameTime.Width - Application.GetRealWidth(10 * 2), frameTime.Height, false); |
| | | txtInput.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | txtInput.Gravity = Gravity.CenterHorizontal; |
| | | txtInput.TextAlignment = TextAlignment.Center; |
| | | txtInput.Text = "12"; |
| | | txtInput.MaxByte = 2; |
| | | txtInput.IsNumberKeyboardType = true; |
| | | frameTime.AddChidren(txtInput); |
| | | |
| | | //小时后失效 |
| | | var btnMsg2 = new NormalViewControl(btnMsg1.Width, btnMsg1.Height, false); |
| | | btnMsg2.X = frameTime.Right + Application.GetRealWidth(12); |
| | | btnMsg2.Y = btnMsg1.Y; |
| | | btnMsg2.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnMsg2.IsMoreLines = true; |
| | | btnMsg2.Text = strArryMsg.Length > 1 ? strArryMsg[1].Trim() : string.Empty; |
| | | frameCenter.AddChidren(btnMsg2); |
| | | |
| | | //错误显示消息 |
| | | var btnErrorMsg = new NormalViewControl(frameCenter.Width - Application.GetRealWidth(20) * 2, Application.GetRealHeight(21), false); |
| | | btnErrorMsg.Y = btnMsg1.Bottom; |
| | | btnErrorMsg.Gravity = Gravity.CenterHorizontal; |
| | | btnErrorMsg.TextColor = CSS_Color.WarningColor; |
| | | btnErrorMsg.IsMoreLines = true; |
| | | btnErrorMsg.TextAlignment = TextAlignment.TopLeft; |
| | | //btnErrorMsg.Height = Application.GetRealHeight(21) * btnErrorMsg.GetRealRowCountByText(); |
| | | btnErrorMsg.Visible = false; |
| | | frameCenter.AddChidren(btnErrorMsg); |
| | | |
| | | //确认 |
| | | var btnConfirm = new NormalViewControl(frameCenter.Width, Application.GetRealHeight(45), false); |
| | | btnConfirm.Gravity = Gravity.BottomCenter; |
| | | btnConfirm.TextAlignment = TextAlignment.Center; |
| | | btnConfirm.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnConfirm.TextColor = CSS_Color.MainBackgroundColor; |
| | | btnConfirm.BackgroundColor = CSS_Color.MainColor; |
| | | btnConfirm.Text = Language.StringByID(StringId.Confirm); |
| | | frameCenter.AddChidren(btnConfirm); |
| | | btnConfirm.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); |
| | | btnConfirm.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //检测输入的时间是否正确 |
| | | var errorMsg = this.CheckInputTime(txtInput.Text.Trim()); |
| | | if (errorMsg != string.Empty) |
| | | { |
| | | //看看消息显示的控件有没有大于34,大于的话,则算出它增加的宽度(34是输入框到底部按钮Y轴的空白区域) |
| | | int value = 0; |
| | | if (btnErrorMsg.Height > Application.GetRealHeight(34)) |
| | | { |
| | | //5是与底部按钮Y轴的间距 |
| | | value = btnErrorMsg.Height - Application.GetRealHeight(34) + Application.GetRealHeight(5); |
| | | } |
| | | //调整白色桌布的高度和坐标 |
| | | frameCenter.Height = frameTime.Bottom + Application.GetRealHeight(34) + btnConfirm.Height + value; |
| | | //白色背景在蓝湖上的坐标为239,高度为172 然后让它按这个比例置于桌布 |
| | | frameCenter.Y = Application.GetRealHeight(239) - (frameCenter.Height - Application.GetRealHeight(172)) / 2; |
| | | btnConfirm.Gravity = Gravity.BottomCenter; |
| | | //按钮置底 |
| | | return; |
| | | } |
| | | //关闭界面 |
| | | dialogForm.Close(); |
| | | //回调函数 |
| | | FinishEvent?.Invoke(Convert.ToInt32(txtInput.Text.Trim())); |
| | | FinishEvent = null; |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 检测输入的时间是否正确 |
| | | /// </summary> |
| | | /// <param name="i_value">输入的时间</param> |
| | | /// <returns></returns> |
| | | private string CheckInputTime(string i_value) |
| | | { |
| | | if (i_value == string.Empty) |
| | | { |
| | | //请输入失效时间 |
| | | return Language.StringByID(StringId.PleaseInputFailTime); |
| | | } |
| | | int value = Convert.ToInt32(i_value); |
| | | if (value < 1) |
| | | { |
| | | //失效时间不能小于1小时 |
| | | return Language.StringByID(StringId.InvalidTimeLessThan1); |
| | | } |
| | | if (value > 72) |
| | | { |
| | | //失效时间不能大于72小时 |
| | | return Language.StringByID(StringId.InvalidTimeMoreThan72); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁历史记录的界面(多门锁时,才能进来) |
| | | /// </summary> |
| | | public class DoorLockHistoryInfoPage : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 门锁设备列表 |
| | | /// </summary> |
| | | private List<Function> listDevice = new List<Function>(); |
| | | /// <summary> |
| | | /// 成员列表 |
| | | /// </summary> |
| | | private List<ResidenceMemberInfo> listMember = null; |
| | | /// <summary> |
| | | /// 默认选择的用户 |
| | | /// </summary> |
| | | private List<string> listSelectUser = new List<string> { "all" }; |
| | | /// <summary> |
| | | /// 默认选择的开锁方式 |
| | | /// </summary> |
| | | private List<string> listUnlock = new List<string> { "all" }; |
| | | /// <summary> |
| | | /// 默认选择的信息类型 |
| | | /// </summary> |
| | | private List<string> listMsgType = new List<string> { "all" }; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | /// <param name="i_listDevice">门锁设备列表</param> |
| | | public void ShowForm(List<Function> i_listDevice) |
| | | { |
| | | this.listDevice.AddRange(i_listDevice); |
| | | |
| | | //历史记录 |
| | | base.SetTitleText(Language.StringByID(StringId.HistoryLog)); |
| | | |
| | | //初始化头部筛选控件 |
| | | this.InitTopScreenControl(); |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化筛选控件_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化头部筛选控件 |
| | | /// </summary> |
| | | private void InitTopScreenControl() |
| | | { |
| | | //右上角的筛选控件 |
| | | var btnScreenContr = new PicViewControl(28, 28); |
| | | btnScreenContr.X = Application.GetRealWidth(337); |
| | | btnScreenContr.Y = Application.GetRealHeight(9); |
| | | btnScreenContr.UnSelectedImagePath = "FunctionIcon/DoorLock/Screen.png"; |
| | | topFrameLayout.AddChidren(btnScreenContr);; |
| | | btnScreenContr.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //初始化成员列表信息 |
| | | if (this.InitMemberListInfo() == false) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var form = new DoorLockHistoryTypeScreenPage(null, this.listMember); |
| | | form.InitControl(null, this.listSelectUser, this.listUnlock, this.listMsgType); |
| | | form.FinishEvent += (list1, list2, list3, list4) => |
| | | { |
| | | //更改缓存 |
| | | this.listSelectUser.Clear(); |
| | | this.listSelectUser.AddRange(list2); |
| | | |
| | | this.listUnlock.Clear(); |
| | | this.listUnlock.AddRange(list3); |
| | | |
| | | this.listMsgType.Clear(); |
| | | this.listMsgType.AddRange(list4); |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化成员列表信息_________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化成员列表信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private bool InitMemberListInfo() |
| | | { |
| | | //已经初始化 |
| | | if (this.listMember != null) { return true; } |
| | | |
| | | //主账号需要去获取成员列表,而子账号只能他自己 |
| | | if (DB_ResidenceData.Instance.CurrentRegion.IsOthreShare == false) |
| | | { |
| | | //获取成员列表 |
| | | var responePack = new DAL.Server.HttpServerRequest().GetResidenceMemberAccount(); |
| | | if (responePack.Code == DAL.Server.StateCode.SUCCESS) |
| | | { |
| | | this.listMember = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ResidenceMemberInfo>>(responePack.Data.ToString()); |
| | | } |
| | | //失败 |
| | | else |
| | | { |
| | | //提示 |
| | | DAL.Server.IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //先初始化 |
| | | this.listMember = new List<ResidenceMemberInfo>(); |
| | | } |
| | | |
| | | //自身加进去,自己位于首位 |
| | | var info = new ResidenceMemberInfo(); |
| | | info.childAccountId = OnAppConfig.Instance.LastLoginUserId; |
| | | info.childAccountType = DB_ResidenceData.Instance.CurrentRegion.IsOthreShare == false ? "ADMIN" : "ORDINARY"; |
| | | info.nickName = UserInfo.Current.userName; |
| | | this.listMember.Insert(0, info); |
| | | if (string.IsNullOrEmpty(info.nickName)) |
| | | { |
| | | info.nickName = UserInfo.Current.AccountString; |
| | | } |
| | | |
| | | foreach (var info2 in this.listMember) |
| | | { |
| | | //设置用户昵称 |
| | | if (string.IsNullOrEmpty(info2.nickName)) |
| | | { |
| | | info2.nickName = info2.memberName; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁历史记录的筛选界面(不需要加入父控件) |
| | | /// </summary> |
| | | public class DoorLockHistoryTypeScreenPage : BottomDialogCommon |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// <para>[1]、选择的门锁品牌 all:全部</para> |
| | | /// <para>[2]、选择的用户 all:全部</para> |
| | | /// <para>[3]、选择的开锁方式 all:全部</para> |
| | | /// <para>[4]、选择的信息类型 all:全部 1:开锁信息 2:报警类信息</para> |
| | | /// </summary> |
| | | public Action<List<string>, List<string>, List<string>, List<string>> FinishEvent = null; |
| | | /// <summary> |
| | | /// 门锁设备,当不为null时,将会出现【锁的型号】的筛选选项 |
| | | /// </summary> |
| | | private List<Function> listDevice = null; |
| | | /// <summary> |
| | | /// 成员列表 |
| | | /// </summary> |
| | | private List<ResidenceMemberInfo> listMember = null; |
| | | /// <summary> |
| | | /// 默认选择的门锁品牌 |
| | | /// </summary> |
| | | private List<string> listSelectSpk = null; |
| | | /// <summary> |
| | | /// 默认选择的用户 |
| | | /// </summary> |
| | | private List<string> listSelectUser = null; |
| | | /// <summary> |
| | | /// 默认选择的开锁方式 |
| | | /// </summary> |
| | | private List<string> listUnlock = null; |
| | | /// <summary> |
| | | /// 默认选择的信息类型 |
| | | /// </summary> |
| | | private List<string> listMsgType = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 门锁历史记录的筛选界面(不需要加入父控件) |
| | | /// </summary> |
| | | /// <param name="i_listDevice">门锁设备,当不为null时,将会出现【锁的型号】的筛选选项</param> |
| | | /// <param name="i_listMember">成员列表</param> |
| | | public DoorLockHistoryTypeScreenPage(List<Function> i_listDevice, List<ResidenceMemberInfo> i_listMember) |
| | | { |
| | | //之后会自动调整的 |
| | | base.RowCount = 7; |
| | | //筛选 |
| | | base.StrTitle = Language.StringByID(StringId.Screen); |
| | | |
| | | this.listDevice = i_listDevice; |
| | | this.listMember = i_listMember; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件 |
| | | /// </summary> |
| | | /// <param name="i_listSelectSpk">默认选择的门锁品牌</param> |
| | | /// <param name="i_listSelectUser">默认选择的用户</param> |
| | | /// <param name="i_listUnlock">默认选择的开锁方式</param> |
| | | /// <param name="i_listMsgType">默认选择的信息类型</param> |
| | | public void InitControl(List<string> i_listSelectSpk, List<string> i_listSelectUser, List<string> i_listUnlock, List<string> i_listMsgType) |
| | | { |
| | | //已经初始化 |
| | | if (base.btnCancel != null) { return; } |
| | | |
| | | //合并List集合 |
| | | this.MergeList(ref this.listSelectSpk, i_listSelectSpk); |
| | | this.MergeList(ref this.listSelectUser, i_listSelectUser); |
| | | this.MergeList(ref this.listUnlock, i_listUnlock); |
| | | this.MergeList(ref this.listMsgType, i_listMsgType); |
| | | |
| | | //初始化底层控件 |
| | | var frameWhiteBack = base.InitBaseControl(Application.CurrentWidth, false); |
| | | //取消 |
| | | base.btnCancel.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.Close(); |
| | | }; |
| | | |
| | | //确认 |
| | | base.btnConfirm.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.FinishEvent?.Invoke(listSelectSpk, listSelectUser, listUnlock, listMsgType); |
| | | this.Close(); |
| | | }; |
| | | //列表控件 |
| | | var listView = new VerticalFrameControl(); |
| | | listView.Y = btnConfirm.Bottom; |
| | | listView.Height = this.RowCount * this.RowHeight; |
| | | frameWhiteBack.AddChidren(listView); |
| | | |
| | | //初始化列表控件 |
| | | this.InitListControl(frameWhiteBack, listView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化列表控件 |
| | | /// </summary> |
| | | /// <param name="listView"></param> |
| | | private void InitListControl(NormalFrameLayout frameWhiteBack, VerticalFrameControl listView) |
| | | { |
| | | //初始Y轴为18 |
| | | int yy = Application.GetRealHeight(18); |
| | | |
| | | //初始化锁按钮 |
| | | yy = this.InitLockButton(listView, yy); |
| | | if (this.listDevice != null && this.listDevice.Count > 0) |
| | | { |
| | | //如果listDevice不为null的话,需要 + 20 |
| | | yy += Application.GetRealHeight(20); |
| | | } |
| | | |
| | | //初始化用户按钮(返回最底部的坐标) |
| | | yy = this.InitUserButton(listView, yy); |
| | | |
| | | //初始化开锁方式按钮(返回最底部的坐标) |
| | | yy = this.InitUnLockButton(listView, yy + Application.GetRealHeight(20)); |
| | | |
| | | //初始化信息类型按钮(返回最底部的坐标) |
| | | yy = this.InitMessageTypeButton(listView, yy + Application.GetRealHeight(20)); |
| | | |
| | | //再加上一个底部间距 |
| | | var frameSpace = new FrameLayout(); |
| | | frameSpace.Height = Application.GetRealHeight(16); |
| | | frameSpace.Y = yy; |
| | | listView.frameTable.AddChidren(frameSpace); |
| | | |
| | | //调整一下高度 |
| | | int realHeight = Application.GetRealHeight(500); |
| | | listView.AdjustTableHeight(); |
| | | if (listView.frameTable.Height < realHeight) |
| | | { |
| | | //500为最大高度,如果比500小,则用当前的真实高度 |
| | | realHeight = listView.frameTable.Height; |
| | | } |
| | | listView.Height = realHeight; |
| | | frameWhiteBack.Height = base.btnConfirm.Bottom + listView.Height; |
| | | //调整一下坐标 |
| | | frameWhiteBack.Gravity = Gravity.BottomCenter; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 全部点击按钮_______________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化锁按钮(返回最底部的坐标) |
| | | /// </summary> |
| | | /// <param name="listView">列表控件</param> |
| | | /// <param name="yy">初始Y轴坐标</param> |
| | | /// <returns></returns> |
| | | private int InitLockButton(VerticalFrameControl listView, int yy) |
| | | { |
| | | //获取所有门锁的品牌 |
| | | var dicLockBrand = this.GetAllLockBrand(); |
| | | if (dicLockBrand.Count > 0) |
| | | { |
| | | //控件集合 |
| | | var listLockContr = new List<NormalViewControl>(); |
| | | //锁 |
| | | var btnLock = new NormalViewControl(150, 20, true); |
| | | btnLock.X = Application.GetRealHeight(24); |
| | | btnLock.Y = yy; |
| | | btnLock.TextID = StringId.Lock; |
| | | listView.frameTable.AddChidren(btnLock); |
| | | //全部 |
| | | var btnContr1 = this.InitSelectButton(Language.StringByID(StringId.All), listLockContr, this.listSelectSpk, this.listSelectSpk.Contains("all")); |
| | | btnContr1.MainKey = "all"; |
| | | listLockContr.Add(btnContr1); |
| | | foreach (var strSpk in dicLockBrand.Keys) |
| | | { |
| | | //初始化按钮 |
| | | var btnContr2 = this.InitSelectButton(dicLockBrand[strSpk], listLockContr, this.listSelectSpk, this.listSelectSpk.Contains(strSpk)); |
| | | btnContr2.MainKey = strSpk; |
| | | listLockContr.Add(btnContr2); |
| | | } |
| | | //放置所有的按钮到容器,返回最底部控件的底部坐标 |
| | | yy = this.SetAllButtonToFrame(listView.frameTable, listLockContr, btnLock.Bottom + Application.GetRealHeight(8)); |
| | | } |
| | | return yy; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化用户按钮(返回最底部的坐标) |
| | | /// </summary> |
| | | /// <param name="listView">列表控件</param> |
| | | /// <param name="yy">初始Y轴坐标</param> |
| | | /// <returns></returns> |
| | | private int InitUserButton(VerticalFrameControl listView, int yy) |
| | | { |
| | | //控件集合 |
| | | var listContr = new List<NormalViewControl>(); |
| | | //用户 |
| | | var btnLock = new NormalViewControl(150, 20, true); |
| | | btnLock.X = Application.GetRealHeight(24); |
| | | btnLock.Y = yy; |
| | | btnLock.TextID = StringId.User; |
| | | listView.frameTable.AddChidren(btnLock); |
| | | //全部 |
| | | var btnContr1 = this.InitSelectButton(Language.StringByID(StringId.All), listContr, this.listSelectUser, this.listSelectUser.Contains("all")); |
| | | btnContr1.MainKey = "all"; |
| | | listContr.Add(btnContr1); |
| | | foreach (var info in this.listMember) |
| | | { |
| | | //初始化按钮 |
| | | var btnContr2 = this.InitSelectButton(info.nickName, listContr, this.listSelectUser, this.listSelectUser.Contains(info.childAccountId)); |
| | | btnContr2.MainKey = info.childAccountId; |
| | | listContr.Add(btnContr2); |
| | | } |
| | | //放置所有的按钮到容器,返回最底部控件的底部坐标 |
| | | yy = this.SetAllButtonToFrame(listView.frameTable, listContr, btnLock.Bottom + Application.GetRealHeight(8)); |
| | | return yy; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化开锁方式按钮(返回最底部的坐标) |
| | | /// </summary> |
| | | /// <param name="listView">列表控件</param> |
| | | /// <param name="yy">初始Y轴坐标</param> |
| | | /// <returns></returns> |
| | | private int InitUnLockButton(VerticalFrameControl listView, int yy) |
| | | { |
| | | //控件集合 |
| | | var listContr = new List<NormalViewControl>(); |
| | | //开锁方式 |
| | | var btnLock = new NormalViewControl(150, 20, true); |
| | | btnLock.X = Application.GetRealHeight(24); |
| | | btnLock.Y = yy; |
| | | btnLock.TextID = StringId.UnlockingMode; |
| | | listView.frameTable.AddChidren(btnLock); |
| | | //全部 |
| | | var btnContr1 = this.InitSelectButton(Language.StringByID(StringId.All), listContr, this.listUnlock, this.listUnlock.Contains("all")); |
| | | btnContr1.MainKey = "all"; |
| | | listContr.Add(btnContr1); |
| | | //指纹 |
| | | btnContr1 = this.InitSelectButton(Language.StringByID(StringId.Fingerprints), listContr, this.listUnlock, this.listUnlock.Contains("15")); |
| | | btnContr1.MainKey = "15"; |
| | | listContr.Add(btnContr1); |
| | | //密码 |
| | | btnContr1 = this.InitSelectButton(Language.StringByID(StringId.Password), listContr, this.listUnlock, this.listUnlock.Contains("0")); |
| | | btnContr1.MainKey = "0"; |
| | | listContr.Add(btnContr1); |
| | | //卡 |
| | | btnContr1 = this.InitSelectButton(Language.StringByID(StringId.Card), listContr, this.listUnlock, this.listUnlock.Contains("3")); |
| | | btnContr1.MainKey = "3"; |
| | | listContr.Add(btnContr1); |
| | | //钥匙 |
| | | btnContr1 = this.InitSelectButton(Language.StringByID(StringId.Key), listContr, this.listUnlock, this.listUnlock.Contains("key")); |
| | | btnContr1.MainKey = "key"; |
| | | listContr.Add(btnContr1); |
| | | //常开 |
| | | btnContr1 = this.InitSelectButton(Language.StringByID(StringId.AlwaysOn), listContr, this.listUnlock, this.listUnlock.Contains("9000")); |
| | | btnContr1.MainKey = "9000"; |
| | | listContr.Add(btnContr1); |
| | | //临时密码开锁 |
| | | btnContr1 = this.InitSelectButton(Language.StringByID(StringId.TemporaryPasswordUnlocking), listContr, this.listUnlock, this.listUnlock.Contains("temp")); |
| | | btnContr1.MainKey = "temp"; |
| | | listContr.Add(btnContr1); |
| | | |
| | | //放置所有的按钮到容器,返回最底部控件的底部坐标 |
| | | yy = this.SetAllButtonToFrame(listView.frameTable, listContr, btnLock.Bottom + Application.GetRealHeight(8)); |
| | | return yy; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化信息类型按钮(返回最底部的坐标) |
| | | /// </summary> |
| | | /// <param name="listView">列表控件</param> |
| | | /// <param name="yy">初始Y轴坐标</param> |
| | | /// <returns></returns> |
| | | private int InitMessageTypeButton(VerticalFrameControl listView, int yy) |
| | | { |
| | | //控件集合 |
| | | var listContr = new List<NormalViewControl>(); |
| | | //信息类型 |
| | | var btnTitle = new NormalViewControl(150, 20, true); |
| | | btnTitle.X = Application.GetRealHeight(24); |
| | | btnTitle.Y = yy; |
| | | btnTitle.TextID = StringId.UnlockingMode; |
| | | listView.frameTable.AddChidren(btnTitle); |
| | | //全部 |
| | | var btnContr1 = this.InitSelectButton(Language.StringByID(StringId.All), listContr, this.listMsgType, this.listMsgType.Contains("all")); |
| | | btnContr1.MainKey = "all"; |
| | | listContr.Add(btnContr1); |
| | | //开锁信息 |
| | | btnContr1 = this.InitSelectButton(Language.StringByID(StringId.UnlockingMessage), listContr, this.listMsgType, this.listMsgType.Contains("1")); |
| | | btnContr1.MainKey = "1"; |
| | | listContr.Add(btnContr1); |
| | | //报警类信息 |
| | | btnContr1 = this.InitSelectButton(Language.StringByID(StringId.AlarmMessage), listContr, this.listMsgType, this.listMsgType.Contains("2")); |
| | | btnContr1.MainKey = "2"; |
| | | listContr.Add(btnContr1); |
| | | |
| | | //放置所有的按钮到容器,返回最底部控件的底部坐标 |
| | | yy = this.SetAllButtonToFrame(listView.frameTable, listContr, btnTitle.Bottom + Application.GetRealHeight(8)); |
| | | |
| | | return yy; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化点击按钮_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化点击按钮 |
| | | /// </summary> |
| | | /// <param name="i_text">显示的文本</param> |
| | | /// <param name="listContr">生成的按钮集合,在生成UI过程中,请勿使用,因为它还没有完成</param> |
| | | /// <param name="listSelect">选择的主键</param> |
| | | /// <param name="select">是否初始选择</param> |
| | | /// <returns></returns> |
| | | private NormalViewControl InitSelectButton(string i_text, List<NormalViewControl> listContr, List<string> listSelectKey, bool select) |
| | | { |
| | | var btnContr = new NormalViewControl(98, 44, true); |
| | | btnContr.Radius = (uint)Application.GetRealWidth(8); |
| | | btnContr.TextAlignment = TextAlignment.Center; |
| | | btnContr.Text = i_text; |
| | | //设置按钮状态 |
| | | this.SetButtonStatu(btnContr, select); |
| | | |
| | | btnContr.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var value = btnContr.MainKey; |
| | | //取消 |
| | | if (listSelectKey.Contains(value) == true) |
| | | { |
| | | if (value == "all" || listSelectKey.Count == 1) |
| | | { |
| | | //不能取消【全部】,并且至少要选择一个 |
| | | return; |
| | | } |
| | | //设置按钮状态 |
| | | this.SetButtonStatu(btnContr, false); |
| | | listSelectKey.Remove(value); |
| | | } |
| | | //选择 |
| | | else |
| | | { |
| | | //设置按钮状态 |
| | | this.SetButtonStatu(btnContr, true); |
| | | if (value == "all") |
| | | { |
| | | //【所有】按钮处于选择状态时,【所有】放在第0位索引 |
| | | for (int i = 1; i < listContr.Count; i++) |
| | | { |
| | | //设置按钮状态 |
| | | this.SetButtonStatu(listContr[i], false); |
| | | //移除选择 |
| | | listSelectKey.Remove(listContr[i].MainKey); |
| | | } |
| | | } |
| | | else if (listSelectKey.Contains("all") == true) |
| | | { |
| | | //所有按钮取消,【所有放在第0位索引】 |
| | | this.SetButtonStatu(listContr[0], false); |
| | | listSelectKey.Remove("all"); |
| | | } |
| | | listSelectKey.Add(value); |
| | | } |
| | | }; |
| | | |
| | | return btnContr; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 放置所有按钮_______________________ |
| | | |
| | | /// <summary> |
| | | /// 放置所有的按钮到容器,返回最底部控件的底部坐标 |
| | | /// </summary> |
| | | /// <param name="frameBack">容器</param> |
| | | /// <param name="listContr">列表控件</param> |
| | | /// <param name="i_yy">初始Y轴</param> |
| | | private int SetAllButtonToFrame(FrameLayout frameBack, List<NormalViewControl> listContr, int i_yy) |
| | | { |
| | | //初始X轴 |
| | | int defultXX = Application.GetRealWidth(24); |
| | | int nowXX = defultXX; |
| | | //按钮间的间距 |
| | | int space = Application.GetRealWidth(16); |
| | | //按钮最大宽度 |
| | | int maxWidth = Application.GetRealWidth(98) * 2 + space; |
| | | //按钮最小宽度 |
| | | int minWidth = Application.GetRealWidth(98); |
| | | |
| | | //桌布的宽度 |
| | | int tableWidth = frameBack.Width - nowXX * 2; |
| | | |
| | | int bottomY = 0; |
| | | foreach (var contr in listContr) |
| | | { |
| | | //计算它的真实宽度,但是不能超过最大宽度 |
| | | int realWidth = contr.GetRealWidthByText(); |
| | | if (realWidth >= maxWidth) |
| | | { |
| | | //最大宽度 |
| | | realWidth = maxWidth; |
| | | } |
| | | else if (realWidth <= minWidth) |
| | | { |
| | | //最小宽度 |
| | | realWidth = minWidth; |
| | | } |
| | | else |
| | | { |
| | | //如果它介于最小和最大之间,则用它的真实值+10,让它左右有点间距,即使超过,应该也没啥事 |
| | | realWidth += Application.GetRealWidth(10); |
| | | } |
| | | contr.Width = realWidth; |
| | | frameBack.AddChidren(contr); |
| | | |
| | | //再计算加上它有没有超过右边界(需要减掉初始X轴) |
| | | if (nowXX + realWidth - defultXX <= tableWidth) |
| | | { |
| | | //没有超过边界,可以直接添加 |
| | | contr.X = nowXX; |
| | | contr.Y = i_yy; |
| | | } |
| | | else |
| | | { |
| | | //如果超过了边界,则换行,重置X轴,Y轴向下推移 |
| | | contr.X = defultXX; |
| | | contr.Y = i_yy + contr.Height + space; |
| | | i_yy = contr.Y; |
| | | } |
| | | //X轴往右推移 |
| | | nowXX = contr.Right + space; |
| | | //底部坐标(返回值) |
| | | bottomY = contr.Bottom; |
| | | } |
| | | return bottomY; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 获取所有门锁的品牌 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private Dictionary<string, string> GetAllLockBrand() |
| | | { |
| | | if (this.listDevice == null || this.listDevice.Count == 0) |
| | | { |
| | | return new Dictionary<string, string>(); |
| | | } |
| | | |
| | | var dicData = new Dictionary<string, string>(); |
| | | foreach (var device in this.listDevice) |
| | | { |
| | | if (device.spk == "door.sone") |
| | | { |
| | | dicData[device.spk] = "S-ONE"; |
| | | continue; |
| | | } |
| | | } |
| | | return dicData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置按钮状态 |
| | | /// </summary> |
| | | /// <param name="btnContr">控件</param> |
| | | /// <param name="select">是否是选择状态</param> |
| | | private void SetButtonStatu(NormalViewControl btnContr, bool select) |
| | | { |
| | | if (select == false) |
| | | { |
| | | btnContr.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnContr.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | btnContr.BorderWidth = 1; |
| | | btnContr.BorderColor = CSS_Color.PromptingColor1; |
| | | } |
| | | else |
| | | { |
| | | btnContr.TextColor = CSS_Color.MainBackgroundColor; |
| | | btnContr.BackgroundColor = CSS_Color.MainColor; |
| | | btnContr.BorderWidth = 0; |
| | | btnContr.BorderColor = CSS_Color.viewTranslucence; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 合并List集合 |
| | | /// </summary> |
| | | /// <param name="listTarget"></param> |
| | | /// <param name="listSource"></param> |
| | | private void MergeList(ref List<string> listTarget, List<string> listSource) |
| | | { |
| | | if (listSource == null) { return; } |
| | | if (listTarget == null) |
| | | { |
| | | listTarget = new List<string>(); |
| | | } |
| | | listTarget.AddRange(listSource); |
| | | if (listTarget.Count == 0) |
| | | { |
| | | listTarget.Add("all"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 关闭界面 |
| | | /// </summary> |
| | | public override void Close() |
| | | { |
| | | base.Close(); |
| | | this.FinishEvent = null; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁列表界面(有多个门锁的时候,才会显示的界面) |
| | | /// </summary> |
| | | public class DoorLockListPage : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 门锁设备列表 |
| | | /// </summary> |
| | | private List<Function> listDevice = new List<Function>(); |
| | | /// <summary> |
| | | /// 电池控件列表(key:设备的sid) |
| | | /// </summary> |
| | | private Dictionary<string, BatteryPersentControl> dicBatteryContr = new Dictionary<string, BatteryPersentControl>(); |
| | | /// <summary> |
| | | /// 列表控件 |
| | | /// </summary> |
| | | private VerticalListControl listView = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | /// <param name="i_listDevice">门锁设备列表</param> |
| | | public void ShowForm(List<Function> i_listDevice) |
| | | { |
| | | this.listDevice.AddRange(i_listDevice); |
| | | |
| | | //智能门锁 |
| | | base.SetTitleText(Language.StringByID(StringId.DoorLock)); |
| | | |
| | | //初始化头部历史记录控件 |
| | | this.InitTopHistoryControl(); |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | string nowSelectId = string.Empty; |
| | | //楼层下拉图标 |
| | | var btnFloor = new NormalViewControl(100, Application.GetRealHeight(16), false); |
| | | var btnFloorIcon = new IconViewControl(16); |
| | | btnFloorIcon.X = HdlControlResourse.XXLeft; |
| | | btnFloorIcon.Y = Application.GetRealHeight(18); |
| | | btnFloorIcon.UnSelectedImagePath = "Public/DownIcon.png"; |
| | | bodyFrameLayout.AddChidren(btnFloorIcon); |
| | | btnFloorIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //显示下拉列表 |
| | | var form = new FloorRoomSelectPopupView(); |
| | | form.ShowDeviceFunctionView(btnFloor, this.listDevice, (selectId, listFunc) => |
| | | { |
| | | nowSelectId = selectId; |
| | | //重新初始化门锁列表控件 |
| | | this.InitDoorListControl(listFunc); |
| | | |
| | | }, nowSelectId); |
| | | }; |
| | | //楼层 |
| | | btnFloor.X = btnFloorIcon.Right + Application.GetRealWidth(2); |
| | | btnFloor.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnFloor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnFloor.Text = DB_ResidenceData.Instance.CurFloor.roomName; |
| | | btnFloor.Width = btnFloor.GetRealWidthByText(); |
| | | bodyFrameLayout.AddChidren(btnFloor); |
| | | //让它相对图标居中 |
| | | btnFloor.Y = btnFloorIcon.Y + (btnFloorIcon.Height - btnFloor.Height) / 2; |
| | | btnFloor.ButtonClickEvent += (sender, e) => |
| | | { |
| | | btnFloorIcon.ButtonClickEvent(null, null); |
| | | }; |
| | | |
| | | //列表控件 |
| | | this.listView = new VerticalListControl(); |
| | | listView.Y = Application.GetRealHeight(53); |
| | | listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(53); |
| | | bodyFrameLayout.AddChidren(listView); |
| | | |
| | | //初始化门锁列表控件 |
| | | this.InitDoorListControl(this.listDevice); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 添加门锁控件_______________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化门锁列表控件 |
| | | /// </summary> |
| | | private void InitDoorListControl(List<Function> i_listDevice) |
| | | { |
| | | this.listView.RemoveAll(); |
| | | this.dicBatteryContr = new Dictionary<string, BatteryPersentControl>(); |
| | | |
| | | //生成门锁控件 |
| | | foreach (var device in i_listDevice) |
| | | { |
| | | this.AddDoorControl(device); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加门锁控件 |
| | | /// </summary> |
| | | /// <param name="i_device">门锁对象</param> |
| | | private void AddDoorControl(Function i_device) |
| | | { |
| | | //白色背景容器 |
| | | var frameBack = new FrameLayoutStatuControl(); |
| | | frameBack.Width = Application.GetRealWidth(343); |
| | | frameBack.Height = Application.GetRealHeight(96); |
| | | frameBack.Radius = (uint)Application.GetRealWidth(12); |
| | | frameBack.Gravity = Gravity.CenterHorizontal; |
| | | frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | this.listView.AddChidren(frameBack); |
| | | //门锁图标 |
| | | var btnIcon = new IconViewControl(32); |
| | | btnIcon.X = Application.GetRealWidth(10); |
| | | btnIcon.Y = Application.GetRealHeight(15); |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/DoorLock.png"; |
| | | frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent); |
| | | //设备名字 |
| | | var btnName = new Button(); |
| | | btnName.X = btnIcon.Right + Application.GetRealWidth(12); |
| | | btnName.Y = Application.GetRealHeight(12); |
| | | btnName.Width = Application.GetRealWidth(150); |
| | | btnName.Height = Application.GetRealHeight(20); |
| | | btnName.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnName.TextAlignment = TextAlignment.CenterLeft; |
| | | btnName.Text = i_device.name; |
| | | frameBack.AddChidren(btnName, ChidrenBindMode.BindEvent); |
| | | //房间 |
| | | var btnRoom = new Button(); |
| | | btnRoom.X = btnName.X; |
| | | btnRoom.Y = btnName.Bottom + Application.GetRealHeight(4); |
| | | btnRoom.Width = Application.GetRealWidth(150); |
| | | btnRoom.Height = Application.GetRealHeight(15); |
| | | btnRoom.TextColor = CSS_Color.PromptingColor1; |
| | | btnRoom.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; |
| | | btnRoom.TextAlignment = TextAlignment.CenterLeft; |
| | | btnRoom.Text = i_device.GetRoomListName(); |
| | | frameBack.AddChidren(btnRoom, ChidrenBindMode.BindEvent); |
| | | //电池图标 |
| | | var btnBattery = new BatteryPersentControl(); |
| | | btnBattery.Y = Application.GetRealHeight(62); |
| | | frameBack.AddChidren(btnBattery, ChidrenBindMode.BindEvent); |
| | | btnBattery.InitControl(); |
| | | btnBattery.SetValue(80); |
| | | btnBattery.X = frameBack.Width - btnBattery.Width - Application.GetRealWidth(12); |
| | | this.dicBatteryContr[i_device.sid] = btnBattery; |
| | | frameBack.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var form = new DoorLockPage(); |
| | | form.AddForm(i_device, new Button(), btnName, btnRoom); |
| | | }; |
| | | |
| | | //底部再加个间距 |
| | | var frameSpace = new FrameLayout(); |
| | | frameSpace.Height = Application.GetRealHeight(12); |
| | | this.listView.AddChidren(frameSpace); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化头部历史记录图标_____________ |
| | | |
| | | /// <summary> |
| | | /// 初始化头部历史记录控件 |
| | | /// </summary> |
| | | private void InitTopHistoryControl() |
| | | { |
| | | //历史记录图标 |
| | | var btnIcon = new IconViewControl(28); |
| | | btnIcon.X = Application.GetRealWidth(337); |
| | | btnIcon.Y = Application.GetRealHeight(9); |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/History.png"; |
| | | topFrameLayout.AddChidren(btnIcon); |
| | | btnIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var form = new DoorLockHistoryInfoPage(); |
| | | form.AddForm(this.listDevice); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 设备状态推送_______________________ |
| | | |
| | | /// <summary> |
| | | /// 设备状态推送 |
| | | /// </summary> |
| | | /// <param name="i_LocalDevice"></param> |
| | | public override void DeviceStatuPush(Function i_LocalDevice) |
| | | { |
| | | //不是目标设备 |
| | | if (this.dicBatteryContr.ContainsKey(i_LocalDevice.sid) == false) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁的控制界面 |
| | | /// </summary> |
| | | public class DoorLockPage : DeviceFunctionCardCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 电池控件 |
| | | /// </summary> |
| | | private BatteryPersentControl batteryControl = null; |
| | | /// <summary> |
| | | /// 在线图标控件 |
| | | /// </summary> |
| | | private IconViewControl btnOnlineIcon = null; |
| | | /// <summary> |
| | | /// 在线文本控件 |
| | | /// </summary> |
| | | private NormalViewControl btnOnlineView = null; |
| | | /// <summary> |
| | | /// 声音图标 |
| | | /// </summary> |
| | | private IconViewControl btnVoice = null; |
| | | /// <summary> |
| | | /// 声音的滑动条控件 |
| | | /// </summary> |
| | | private SeekBarImageControl seekBarVoiceControl = null; |
| | | /// <summary> |
| | | /// 声音百分比 |
| | | /// </summary> |
| | | private NormalViewControl btnVoicePersent = null; |
| | | /// <summary> |
| | | /// 常开模式图标 |
| | | /// </summary> |
| | | private IconViewControl btnNormallyOpenIcon = null; |
| | | /// <summary> |
| | | /// 中间的开锁或者关锁图片控件 |
| | | /// </summary> |
| | | private PicViewControl picLockControl = null; |
| | | /// <summary> |
| | | /// 临时密码tab页中间的控件容器(它的Y轴是 一键开锁/临时密码开锁的底部(粗体字体)+4) |
| | | /// </summary> |
| | | private FrameLayout frameTempPsw = null; |
| | | /// <summary> |
| | | /// 1:选择的是一键开锁 2:选择的是临时密码开锁 |
| | | /// </summary> |
| | | private int nowSelectMenu = 1; |
| | | /// <summary> |
| | | /// 门锁数据 |
| | | /// </summary> |
| | | private DoorLockData doorLockData = new DoorLockData(); |
| | | /// <summary> |
| | | /// 门锁的历史记录 |
| | | /// </summary> |
| | | private List<DoorHistoryLog> listHistoryLog = null; |
| | | /// <summary> |
| | | /// 成员列表 |
| | | /// </summary> |
| | | private List<ResidenceMemberInfo> listMember = null; |
| | | /// <summary> |
| | | /// 文本缓存 |
| | | /// </summary> |
| | | private Dictionary<string, string> dicText = new Dictionary<string, string>(); |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 门锁的控制界面 |
| | | /// </summary> |
| | | public DoorLockPage() |
| | | { |
| | | //门锁不允许收藏 |
| | | this.ShowColltionButton = false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化白色区域的内容 |
| | | /// </summary> |
| | | public override void InitFrameWhiteContent() |
| | | { |
| | | //智能门锁 |
| | | base.SetTitleText(Language.StringByID(StringId.DoorLock)); |
| | | |
| | | this.dicText["已连接"] = Language.StringByID(StringId.Connected); |
| | | this.dicText["未连接"] = Language.StringByID(StringId.UnConnected); |
| | | |
| | | //左右翻页的事件 |
| | | base.PageChangeEvent += (index) => |
| | | { |
| | | if (index == 1) |
| | | { |
| | | //初始化门锁历史记录以及控件 |
| | | this.InitDoorHistoryLogAndControl(); |
| | | } |
| | | }; |
| | | |
| | | //刷新当前设备的状态缓存 |
| | | this.RefreshNowDeviceStatuMemory(this.device); |
| | | //初始化第一个索引页的内容 |
| | | this.InitFrameWhiteContent1(); |
| | | //初始化第二个索引页(历史记录) |
| | | this.InitFrameWhiteContent2(); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化第一个索引页的内容 |
| | | /// </summary> |
| | | private void InitFrameWhiteContent1() |
| | | { |
| | | //电池控件 |
| | | this.batteryControl = new BatteryPersentControl(); |
| | | //它有个最小的X轴 |
| | | batteryControl.X = Application.GetRealWidth(104) > base.btnRoomName.Right ? |
| | | Application.GetRealWidth(104) : base.btnRoomName.Right + Application.GetRealWidth(4); |
| | | FrameWhiteCentet1.AddChidren(batteryControl); |
| | | if (batteryControl.Height > base.btnRoomName.Height) |
| | | { |
| | | //一个是25,一个是21,弄不准到底谁更高,因为计算方法不一样 |
| | | batteryControl.Y = base.btnRoomName.Y - (batteryControl.Height - base.btnRoomName.Height) / 2; |
| | | } |
| | | else |
| | | { |
| | | batteryControl.Y = base.btnRoomName.Y + (batteryControl.Height - base.btnRoomName.Height) / 2; |
| | | } |
| | | batteryControl.InitControl(); |
| | | batteryControl.SetValue(100); |
| | | |
| | | //在线状态 |
| | | this.btnOnlineIcon = new IconViewControl(24); |
| | | btnOnlineIcon.X = batteryControl.Right + Application.GetRealWidth(12); |
| | | btnOnlineIcon.Y = batteryControl.Y; |
| | | btnOnlineIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/Connect.png"; |
| | | FrameWhiteCentet1.AddChidren(btnOnlineIcon); |
| | | //在线文本 |
| | | this.btnOnlineView = new NormalViewControl(Application.GetRealWidth(100), btnOnlineIcon.Height, false); |
| | | btnOnlineView.X = btnOnlineIcon.Right + Application.GetRealWidth(4); |
| | | btnOnlineView.Y = btnOnlineIcon.Y; |
| | | btnOnlineView.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; |
| | | btnOnlineView.TextColor = CSS_Color.PromptingColor1; |
| | | btnOnlineView.TextID = StringId.Connected; |
| | | FrameWhiteCentet1.AddChidren(btnOnlineView); |
| | | //右上角配置结束的事件 |
| | | base.SettionFinishEvent += () => |
| | | { |
| | | //从新设置坐标 |
| | | batteryControl.X = Application.GetRealWidth(104) > base.btnRoomName.Right ? |
| | | Application.GetRealWidth(104) : base.btnRoomName.Right + Application.GetRealWidth(4); |
| | | btnOnlineIcon.X = batteryControl.Right + Application.GetRealWidth(12); |
| | | btnOnlineView.X = btnOnlineIcon.Right + Application.GetRealWidth(4); |
| | | }; |
| | | |
| | | //中间的开锁或者关锁图片控件 |
| | | this.picLockControl = new PicViewControl(256, 260); |
| | | picLockControl.Y = Application.GetRealHeight(129); |
| | | picLockControl.Gravity = Gravity.CenterHorizontal; |
| | | picLockControl.UnSelectedImagePath = "FunctionIcon/DoorLock/LockPictrue1.png"; |
| | | FrameWhiteCentet1.AddChidren(picLockControl); |
| | | picLockControl.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //一键开锁 |
| | | this.DoOneKeyToUnlockDoor(); |
| | | }; |
| | | |
| | | //临时密码的控件容器 |
| | | this.frameTempPsw = new FrameLayout(); |
| | | frameTempPsw.Y = Application.GetRealHeight(129); |
| | | frameTempPsw.Height = Application.GetRealHeight(260); |
| | | frameTempPsw.Visible = false; |
| | | FrameWhiteCentet1.AddChidren(frameTempPsw); |
| | | |
| | | //声音 |
| | | this.btnVoice = new IconViewControl(24); |
| | | btnVoice.UnSelectedImagePath = "FunctionIcon/DoorLock/Voice.png"; |
| | | btnVoice.X = Application.GetRealWidth(23); |
| | | btnVoice.Y = Application.GetRealHeight(410); |
| | | FrameWhiteCentet1.AddChidren(btnVoice); |
| | | |
| | | //声音的滑动条 |
| | | this.seekBarVoiceControl = new SeekBarImageControl(215); |
| | | seekBarVoiceControl.Gravity = Gravity.CenterHorizontal; |
| | | FrameWhiteCentet1.AddChidren(seekBarVoiceControl); |
| | | seekBarVoiceControl.Y = btnVoice.Y - (seekBarVoiceControl.Height - btnVoice.Height) / 2; |
| | | //绑定PageLayout控件 |
| | | seekBarVoiceControl.BindPageLayout(); |
| | | |
| | | //声音百分比 |
| | | this.btnVoicePersent = new NormalViewControl(Application.GetRealWidth(50), btnVoice.Height, false); |
| | | btnVoicePersent.X = seekBarVoiceControl.Right + Application.GetRealWidth(8) - seekBarVoiceControl.SeekBarPadding; |
| | | btnVoicePersent.Y = btnVoice.Y; |
| | | btnVoicePersent.TextColor = CSS_Color.PromptingColor1; |
| | | btnVoicePersent.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnVoicePersent.Text = "100%"; |
| | | FrameWhiteCentet1.AddChidren(btnVoicePersent); |
| | | |
| | | seekBarVoiceControl.ProgressChangedEvent += (div, value) => |
| | | { |
| | | btnVoicePersent.Text = value + "%"; |
| | | if (div == 1) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | //初始化开锁菜单(一键开锁,临时密码开锁) |
| | | this.InitUnLockMenuControl(); |
| | | //初始化底部菜单图标 |
| | | this.InitBottomMenuIconControl(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化开锁菜单(一键开锁,临时密码开锁) |
| | | /// </summary> |
| | | private void InitUnLockMenuControl() |
| | | { |
| | | //如果是成员,则只有一键开锁 |
| | | if (DB_ResidenceData.Instance.CurrentRegion.IsOthreShare == true) |
| | | { |
| | | //一键开锁 |
| | | var btnOneKey = new NormalViewControl(100, 25, true); |
| | | btnOneKey.Y = Application.GetRealHeight(100); |
| | | btnOneKey.TextSize = CSS_FontSize.HeadlineFontSize; |
| | | btnOneKey.TextColor = CSS_Color.MainColor; |
| | | btnOneKey.Text = Language.StringByID(StringId.OneKeyUnlocking); |
| | | btnOneKey.Width = this.GetTextRealWidth(btnOneKey.Text, CSS_FontSize.HeadlineFontSize, true); |
| | | btnOneKey.Gravity = Gravity.CenterHorizontal; |
| | | btnOneKey.IsBold = true; |
| | | FrameWhiteCentet1.AddChidren(btnOneKey); |
| | | } |
| | | else |
| | | { |
| | | //一键开锁 |
| | | var btnOneKey = new NormalViewControl(100, 25, true); |
| | | btnOneKey.Y = Application.GetRealHeight(100); |
| | | btnOneKey.TextSize = Language.CurrentLanguage == "Chinese" ? CSS_FontSize.HeadlineFontSize : CSS_FontSize.SubheadingFontSize; |
| | | btnOneKey.TextColor = CSS_Color.MainColor; |
| | | btnOneKey.Text = Language.StringByID(StringId.OneKeyUnlocking); |
| | | btnOneKey.TextAlignment = TextAlignment.CenterRight; |
| | | btnOneKey.IsBold = true; |
| | | btnOneKey.Width = this.GetTextRealWidth(btnOneKey.Text, CSS_FontSize.HeadlineFontSize, true); |
| | | FrameWhiteCentet1.AddChidren(btnOneKey); |
| | | btnOneKey.X = Application.GetRealWidth(140) - btnOneKey.Width; |
| | | |
| | | //临时密码开锁 |
| | | var btnTempPsw = new NormalViewControl(100, 25, true); |
| | | btnTempPsw.X = btnOneKey.Right + Application.GetRealWidth(36); |
| | | btnTempPsw.Y = btnOneKey.Y; |
| | | btnTempPsw.TextColor = CSS_Color.PromptingColor1; |
| | | btnTempPsw.Text = Language.StringByID(StringId.TemporaryPasswordUnlocking); |
| | | btnTempPsw.Width = this.GetTextRealWidth(btnTempPsw.Text, CSS_FontSize.HeadlineFontSize, true); |
| | | FrameWhiteCentet1.AddChidren(btnTempPsw); |
| | | |
| | | btnOneKey.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //选择的是同一个,则不处理 |
| | | if (this.nowSelectMenu == 1) { return; } |
| | | this.nowSelectMenu = 1; |
| | | |
| | | btnOneKey.IsBold = true; |
| | | btnOneKey.TextSize = Language.CurrentLanguage == "Chinese" ? CSS_FontSize.HeadlineFontSize : CSS_FontSize.SubheadingFontSize; |
| | | btnOneKey.TextColor = CSS_Color.MainColor; |
| | | |
| | | btnTempPsw.IsBold = false; |
| | | btnTempPsw.TextSize = CSS_FontSize.TextFontSize; |
| | | btnTempPsw.TextColor = CSS_Color.PromptingColor1; |
| | | |
| | | //设置中间容器控件可视化 |
| | | this.SetMiddleFrameControlVisible(); |
| | | }; |
| | | |
| | | btnTempPsw.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //选择的是同一个,则不处理 |
| | | if (this.nowSelectMenu == 2) { return; } |
| | | this.nowSelectMenu = 2; |
| | | |
| | | btnOneKey.IsBold = false; |
| | | btnOneKey.TextSize = CSS_FontSize.TextFontSize; |
| | | btnOneKey.TextColor = CSS_Color.PromptingColor1; |
| | | |
| | | btnTempPsw.IsBold = true; |
| | | btnTempPsw.TextSize = Language.CurrentLanguage == "Chinese" ? CSS_FontSize.HeadlineFontSize : CSS_FontSize.SubheadingFontSize; |
| | | btnTempPsw.TextColor = CSS_Color.MainColor; |
| | | |
| | | //设置中间容器控件可视化 |
| | | this.SetMiddleFrameControlVisible(); |
| | | }; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化第二个索引页(历史记录)_______ |
| | | |
| | | /// <summary> |
| | | /// 初始化第二个索引页(历史记录) |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | //添加第二个page |
| | | this.AddSecondPage(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化门锁历史记录以及控件 |
| | | /// </summary> |
| | | private void InitDoorHistoryLogAndControl() |
| | | { |
| | | //已经初始化 |
| | | if (this.listHistoryLog != null) { return; } |
| | | |
| | | this.ShowProgressBar(); |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | //初始化成员列表信息 |
| | | if (this.InitMemberListInfo() == false) |
| | | { |
| | | this.CloseProgressBar(); |
| | | return; |
| | | } |
| | | //获取门锁历史记录 |
| | | this.listHistoryLog = new DAL.Server.HttpServerRequest().GetDoorHistoryLogs(this.device); |
| | | this.CloseProgressBar(); |
| | | if (this.listHistoryLog == null) |
| | | { |
| | | return; |
| | | } |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //初始化门锁历史记录列表控件 |
| | | this.InitDoorHistoryLogListControl(this.listHistoryLog); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化门锁历史记录列表控件 |
| | | /// </summary> |
| | | /// <param name="listLog">显示的门锁记录</param> |
| | | private void InitDoorHistoryLogListControl(List<DoorHistoryLog> listLog) |
| | | { |
| | | //按年分组 |
| | | var dicData = new Dictionary<int, List<DoorHistoryLog>>(); |
| | | foreach (var info in listLog) |
| | | { |
| | | var year = info.Time.Year; |
| | | if (dicData.ContainsKey(year) == false) |
| | | { |
| | | dicData[year] = new List<DoorHistoryLog>(); |
| | | } |
| | | dicData[year].Add(info); |
| | | } |
| | | |
| | | //先清空 |
| | | base.FrameWhiteCentet2.RemoveAll(); |
| | | |
| | | //日志 |
| | | var btnLog = new NormalViewControl(150, 35, true); |
| | | btnLog.Y = Application.GetRealHeight(15); |
| | | btnLog.X = HdlControlResourse.XXLeft; |
| | | btnLog.TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel; |
| | | btnLog.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnLog.TextID = StringId.Log; |
| | | FrameWhiteCentet2.AddChidren(btnLog); |
| | | |
| | | //列表容器 |
| | | var listView = new VerticalFrameControl(); |
| | | listView.Y = Application.GetRealHeight(72); |
| | | listView.Height = base.FrameWhiteCentet2.Height - Application.GetRealHeight(72); |
| | | base.FrameWhiteCentet2.AddChidren(listView); |
| | | |
| | | //初始Y轴为0 |
| | | int yy = 0; |
| | | foreach (var strYear in dicData.Keys) |
| | | { |
| | | //年 |
| | | var btnYear = new NormalViewControl(100, 24, true); |
| | | btnYear.X = HdlControlResourse.XXLeft; |
| | | btnYear.Y = yy; |
| | | btnYear.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnYear.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnYear.Text = strYear.ToString(); |
| | | //中文 |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | btnYear.Text += Language.StringByID(StringId.Years); |
| | | } |
| | | listView.frameTable.AddChidren(btnYear); |
| | | |
| | | //年与消息记录的间距为14 |
| | | yy = btnYear.Bottom + Application.GetRealHeight(14); |
| | | foreach (var logInfo in dicData[strYear]) |
| | | { |
| | | //消息 |
| | | var btnMsg = new NormalViewControl(295, 20, true); |
| | | btnMsg.Y = yy; |
| | | btnMsg.Gravity = Gravity.CenterHorizontal; |
| | | btnMsg.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnMsg.Text = logInfo.StrMsg; |
| | | listView.frameTable.AddChidren(btnMsg); |
| | | //时间 |
| | | var btnTime = new NormalViewControl(200, 18, true); |
| | | btnTime.Y = btnMsg.Bottom + Application.GetRealHeight(2); |
| | | btnTime.X = btnMsg.X; |
| | | btnTime.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnTime.TextColor = CSS_Color.PromptingColor1; |
| | | btnTime.Text = HdlCommonLogic.Current.ConvertDayText(logInfo.Time.Month, logInfo.Time.Day) + " " + logInfo.Time.ToString("HH:mm"); |
| | | listView.frameTable.AddChidren(btnTime); |
| | | //线 |
| | | var btnLine = new NormalViewControl(btnMsg.Width, HdlControlResourse.BottomLineHeight, false); |
| | | btnLine.Y = btnTime.Bottom + Application.GetRealHeight(11); |
| | | btnLine.Gravity = Gravity.CenterHorizontal; |
| | | btnLine.BackgroundColor = CSS_Color.DividingLineColor; |
| | | listView.frameTable.AddChidren(btnLine); |
| | | //两条消息的间距为10 |
| | | yy = btnLine.Bottom + Application.GetRealHeight(10); |
| | | } |
| | | //年与年之间的间距为24 |
| | | yy += Application.GetRealHeight(24); |
| | | } |
| | | //调整桌布高度 |
| | | listView.AdjustTableHeight(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化底部菜单图标_________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化底部菜单图标 |
| | | /// </summary> |
| | | private void InitBottomMenuIconControl() |
| | | { |
| | | //如果是成员,则只有开锁方式管理 |
| | | if (DB_ResidenceData.Instance.CurrentRegion.IsOthreShare == true) |
| | | { |
| | | //开锁方式管理图标 |
| | | var btnManagerIcon = new IconViewControl(40); |
| | | btnManagerIcon.Gravity = Gravity.CenterHorizontal; |
| | | btnManagerIcon.Y = Application.GetRealHeight(466); |
| | | btnManagerIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UnLockManager.png"; |
| | | this.FrameWhiteCentet1.AddChidren(btnManagerIcon); |
| | | btnManagerIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //初始化成员列表信息 |
| | | if (this.InitMemberListInfo() == false) |
| | | { |
| | | return; |
| | | } |
| | | var form = new DoorLockUnlockMethordManagerPage(); |
| | | form.AddForm(this.device, this.listMember); |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | //开锁方式管理图标 |
| | | var btnManagerIcon = new IconViewControl(40); |
| | | btnManagerIcon.Y = Application.GetRealHeight(466); |
| | | btnManagerIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UnLockManager.png"; |
| | | this.FrameWhiteCentet1.AddChidren(btnManagerIcon); |
| | | btnManagerIcon.X = (this.FrameWhiteCentet1.Width - btnManagerIcon.Width * 2 - Application.GetRealWidth(40)) / 2; |
| | | btnManagerIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //初始化成员列表信息 |
| | | if (this.InitMemberListInfo() == false) |
| | | { |
| | | return; |
| | | } |
| | | var form = new DoorLockUnlockMethordManagerPage(); |
| | | form.AddForm(this.device, this.listMember); |
| | | }; |
| | | |
| | | //常开模式图标 |
| | | this.btnNormallyOpenIcon = new IconViewControl(40); |
| | | btnNormallyOpenIcon.X = btnManagerIcon.Right + Application.GetRealWidth(40); |
| | | btnNormallyOpenIcon.Y = btnManagerIcon.Y; |
| | | btnNormallyOpenIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/NormallyOpenIcon2.png"; |
| | | this.FrameWhiteCentet1.AddChidren(btnNormallyOpenIcon); |
| | | btnNormallyOpenIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var form = new DoorLockAlwaysOnListPage(); |
| | | form.AddForm(this.device); |
| | | }; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化临时密码控件_________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化临时密码控件 |
| | | /// </summary> |
| | | private void InitTempPasswordControl() |
| | | { |
| | | this.frameTempPsw.RemoveAll(); |
| | | |
| | | //生成临时密码的背景图片 |
| | | var picBack = new PicViewControl(258, 165); |
| | | picBack.Gravity = Gravity.CenterHorizontal; |
| | | picBack.UnSelectedImagePath = "FunctionIcon/DoorLock/CrearPswBackgroud.png"; |
| | | this.frameTempPsw.AddChidren(picBack); |
| | | |
| | | //密码显示控件 |
| | | var btnPassword = new NormalViewControl(150, 50, true); |
| | | btnPassword.Gravity = Gravity.CenterHorizontal; |
| | | btnPassword.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnPassword.TextColor = CSS_Color.MainBackgroundColor; |
| | | btnPassword.TextAlignment = TextAlignment.Center; |
| | | this.frameTempPsw.AddChidren(btnPassword); |
| | | |
| | | //如果没有临时密码 |
| | | if (this.doorLockData.TempPassword == string.Empty) |
| | | { |
| | | //当没有临时密码时,这个背景放在中间 |
| | | picBack.Y = Application.GetRealHeight(47); |
| | | //因为图片的压缩问题,这个Y轴和蓝湖的不一样,蓝湖是99 |
| | | btnPassword.Y = Application.GetRealHeight(88); |
| | | |
| | | //生成临时密码 |
| | | btnPassword.TextID = StringId.CreatTemporaryPassword; |
| | | btnPassword.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //显示生成临时密码的弹窗界面 |
| | | this.ShowCreatTemporaryPasswordDialog(DateTime.Now, DateTime.Now.AddDays(1).AddMinutes(-1)); |
| | | }; |
| | | } |
| | | //拥有临时密码 |
| | | else |
| | | { |
| | | //显示临时密码 |
| | | btnPassword.Text = this.doorLockData.TempPassword; |
| | | //因为图片的压缩问题,这个Y轴和蓝湖的不一样,蓝湖是51 |
| | | btnPassword.Y = Application.GetRealHeight(40); |
| | | |
| | | //删除临时密码图标 |
| | | var btnDelete = new IconViewControl(28); |
| | | btnDelete.UnSelectedImagePath = "FunctionIcon/DoorLock/Delete.png"; |
| | | btnDelete.X = Application.GetRealWidth(19); |
| | | btnDelete.Y = Application.GetRealHeight(115); |
| | | this.frameTempPsw.AddChidren(btnDelete); |
| | | btnDelete.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //清除当前临时密码? |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.ClearTempPsswordMsg), () => |
| | | { |
| | | //清空临时密码 |
| | | this.doorLockData.TempPassword = string.Empty; |
| | | this.doorLockData.StatrtTime = string.Empty; |
| | | this.doorLockData.EndTime = string.Empty; |
| | | //重新初始化临时密码控件 |
| | | this.InitTempPasswordControl(); |
| | | }); |
| | | }; |
| | | |
| | | //复制临时密码图标 |
| | | var btnCopy = new IconViewControl(28); |
| | | btnCopy.UnSelectedImagePath = "FunctionIcon/DoorLock/Shard.png"; |
| | | btnCopy.X = this.frameTempPsw.Width - btnCopy.IconSize - btnDelete.X; |
| | | btnCopy.Y = btnDelete.Y; |
| | | this.frameTempPsw.AddChidren(btnCopy); |
| | | btnCopy.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //临时密码已经复制 |
| | | HdlCommonLogic.Current.SetTextToShearPlate(this.doorLockData.TempPassword, Language.StringByID(StringId.TempPsswordHasBeenCopy)); |
| | | }; |
| | | |
| | | //生效时间 |
| | | var frameEffective = this.CreatEffectiveTimeControl(this.frameTempPsw, Language.StringByID(StringId.EffectiveTime), this.doorLockData.StatrtTime); |
| | | frameEffective.X = Application.GetRealWidth(24); |
| | | frameEffective.Y = Application.GetRealHeight(180); |
| | | |
| | | //失效时间 |
| | | var frameFailure = this.CreatEffectiveTimeControl(this.frameTempPsw, Language.StringByID(StringId.FailureTime), this.doorLockData.EndTime); |
| | | frameFailure.X = this.frameTempPsw.Width - frameFailure.Width - frameEffective.X; |
| | | frameFailure.Y = frameEffective.Y; |
| | | |
| | | //- |
| | | var btnLine = new NormalViewControl(frameFailure.X - frameEffective.Right, frameFailure.Height, false); |
| | | btnLine.X = frameEffective.Right; |
| | | btnLine.Y = frameEffective.Y; |
| | | btnLine.Text = "-"; |
| | | btnLine.TextAlignment = TextAlignment.Center; |
| | | btnLine.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnLine.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | this.frameTempPsw.AddChidren(btnLine); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成生效/失效时间控件 |
| | | /// </summary> |
| | | /// <param name="frameTempPsw">父控件</param> |
| | | /// <param name="i_text">显示的文本</param> |
| | | /// <param name="i_time">显示的时间</param> |
| | | /// <returns></returns> |
| | | private FrameLayout CreatEffectiveTimeControl(FrameLayout frameTempPsw, string i_text, string i_time) |
| | | { |
| | | //线框背景控件 |
| | | var frameBack = new FrameLayout(); |
| | | frameBack.Width = Application.GetRealWidth(120); |
| | | frameBack.Height = Application.GetRealHeight(50); |
| | | frameBack.Radius = (uint)Application.GetRealWidth(7); |
| | | frameBack.BorderWidth = 1; |
| | | frameBack.BorderColor = CSS_Color.PromptingColor1; |
| | | frameTempPsw.AddChidren(frameBack); |
| | | |
| | | //显示文本 |
| | | var btnText = new NormalViewControl(frameBack.Width, Application.GetRealHeight(18), false); |
| | | btnText.Y = Application.GetRealHeight(8); |
| | | btnText.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnText.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnText.Text = i_text; |
| | | btnText.TextAlignment = TextAlignment.Center; |
| | | frameBack.AddChidren(btnText); |
| | | |
| | | //显示时间 |
| | | var btnTime = new NormalViewControl(frameBack.Width, Application.GetRealHeight(18), false); |
| | | btnTime.Y = btnText.Bottom; |
| | | btnTime.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnTime.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnTime.Text = i_time; |
| | | btnTime.TextAlignment = TextAlignment.Center; |
| | | frameBack.AddChidren(btnTime); |
| | | |
| | | return frameBack; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 生成临时密码_______________________ |
| | | |
| | | /// <summary> |
| | | /// 显示生成临时密码的弹窗界面 |
| | | /// </summary> |
| | | private void ShowCreatTemporaryPasswordDialog(DateTime startTime, DateTime endTime) |
| | | { |
| | | //默认时间Form-To为一天 |
| | | var contr = new BottomItemEditorControl(2, string.Empty); |
| | | //点击确认时,不关闭界面 |
| | | contr.CloseByConfirm = false; |
| | | |
| | | //生效时间 |
| | | var effectiveTime = Language.StringByID(StringId.EffectiveTime); |
| | | contr.AddRowMenu(effectiveTime, startTime.ToString("yyyy.MM.dd HH:mm"), (btnView, btnValue) => |
| | | { |
| | | //关掉界面,然后重新调起来 |
| | | contr.Close(); |
| | | |
| | | var form = new DoorLockSelectTimePage(); |
| | | form.AddForm(startTime); |
| | | form.SelectFinshEvent += (selectTime) => |
| | | { |
| | | //重新调起界面 |
| | | this.ShowCreatTemporaryPasswordDialog(selectTime, endTime); |
| | | }; |
| | | }); |
| | | |
| | | //失效时间 |
| | | var failTime = Language.StringByID(StringId.FailureTime); |
| | | contr.AddRowMenu(failTime, endTime.ToString("yyyy.MM.dd HH:mm"), (btnView, btnValue) => |
| | | { |
| | | //关掉界面,然后重新调起来 |
| | | contr.Close(); |
| | | |
| | | var form = new DoorLockSelectTimePage(); |
| | | form.AddForm(endTime); |
| | | form.SelectFinshEvent += (selectTime) => |
| | | { |
| | | //重新调起界面 |
| | | this.ShowCreatTemporaryPasswordDialog(startTime, selectTime); |
| | | }; |
| | | }); |
| | | contr.FinishEvent += (div) => |
| | | { |
| | | //点击了生成 |
| | | if (div == 1) |
| | | { |
| | | if (this.CheckEffectiveTime(startTime, endTime) == false) |
| | | { |
| | | return; |
| | | } |
| | | //关掉界面 |
| | | contr.Close(); |
| | | |
| | | //生成临时密码 |
| | | this.doorLockData.TempPassword = "987654"; |
| | | this.doorLockData.StatrtTime = startTime.ToString("yyyy.MM.dd HH:mm"); |
| | | this.doorLockData.EndTime = endTime.ToString("yyyy.MM.dd HH:mm"); |
| | | //重新初始化临时密码控件 |
| | | this.InitTempPasswordControl(); |
| | | } |
| | | }; |
| | | |
| | | //需要初始化之后,按钮才不会为null 变更【生成】按钮的宽度和X轴 |
| | | contr.btnConfirm.TextID = StringId.Generate; |
| | | contr.btnConfirm.Width = contr.btnConfirm.GetRealWidthByText(); |
| | | contr.btnConfirm.X = contr.btnConfirm.Parent.Width - contr.btnConfirm.Width - contr.btnCancel.X; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检测生效时间是否正确 |
| | | /// </summary> |
| | | /// <param name="startTime">生效时间</param> |
| | | /// <param name="endTime">失效时间</param> |
| | | /// <returns></returns> |
| | | private bool CheckEffectiveTime(DateTime startTime, DateTime endTime) |
| | | { |
| | | if (startTime >= endTime) |
| | | { |
| | | //生效时间必须大于失效时间 |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.EffectiveTimeMustBeOverFailureTime)); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 设备状态反馈_______________________ |
| | | |
| | | /// <summary> |
| | | /// 设备状态反馈 |
| | | /// </summary> |
| | | /// <param name="i_LocalDevice"></param> |
| | | public override void DeviceStatuPush(Function i_LocalDevice) |
| | | { |
| | | //不是同一个东西 |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //刷新当前设备的状态缓存 |
| | | this.RefreshNowDeviceStatuMemory(i_LocalDevice); |
| | | //刷新界面状态 |
| | | this.RefreshFormStatu(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 刷新界面状态_______________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新界面状态 |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | //如果不在线 |
| | | if (this.doorLockData.IsOnline == false) |
| | | { |
| | | //开锁图片 |
| | | this.picLockControl.UnSelectedImagePath = "FunctionIcon/DoorLock/LockPictrue2.png"; |
| | | //连接状态 |
| | | this.btnOnlineIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UnConnect.png"; |
| | | this.btnOnlineView.Text = this.dicText["未连接"]; |
| | | this.btnOnlineView.TextColor = CSS_Color.AuxiliaryColor2; |
| | | //常开模式图标 |
| | | if (this.btnNormallyOpenIcon != null) |
| | | { |
| | | this.btnNormallyOpenIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/NormallyOpenIcon2.png"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //开锁图片 |
| | | this.picLockControl.UnSelectedImagePath = this.doorLockData.Open == true ? "FunctionIcon/DoorLock/UnLockPictrue3.png" : "FunctionIcon/DoorLock/LockPictrue1.png"; |
| | | //连接状态 |
| | | this.btnOnlineIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/Connect.png"; |
| | | this.btnOnlineView.Text = this.dicText["已连接"]; |
| | | this.btnOnlineView.TextColor = CSS_Color.PromptingColor1; |
| | | //常开模式图标 |
| | | if (this.btnNormallyOpenIcon != null) |
| | | { |
| | | this.btnNormallyOpenIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/NormallyOpenIcon1.png"; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置中间容器控件可视化 |
| | | /// </summary> |
| | | private void SetMiddleFrameControlVisible() |
| | | { |
| | | //如果选择的是 一键开锁 |
| | | if (this.nowSelectMenu == 1) |
| | | { |
| | | this.picLockControl.Visible = true; |
| | | this.frameTempPsw.Visible = false; |
| | | } |
| | | else |
| | | { |
| | | this.picLockControl.Visible = false; |
| | | this.frameTempPsw.Visible = true; |
| | | //临时密码已经变更,需要刷新界面 |
| | | if (this.doorLockData.IsTempPasswordChanged == true) |
| | | { |
| | | //初始化临时密码控件 |
| | | this.InitTempPasswordControl(); |
| | | this.doorLockData.IsTempPasswordChanged = false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 发送各种命令_______________________ |
| | | |
| | | /// <summary> |
| | | /// 发送开关命令 |
| | | /// </summary> |
| | | private void SendSwitchComand() |
| | | { |
| | | //this.btnSwitch.CanClick = false; |
| | | |
| | | //string statu = this.btnSwitch.IsSelected == true ? "off" : "on"; |
| | | //HdlThreadLogic.Current.RunThread(() => |
| | | //{ |
| | | // var dic = new Dictionary<string, string>(); |
| | | // dic.Add(FunctionAttributeKey.OnOff, statu); |
| | | // Control.Ins.SendWriteCommand(this.device, dic, true); |
| | | // HdlThreadLogic.Current.RunMain(() => |
| | | // { |
| | | // this.btnSwitch.CanClick = true; |
| | | // }); |
| | | //}); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化成员列表信息_________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化成员列表信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private bool InitMemberListInfo() |
| | | { |
| | | //已经初始化 |
| | | if (this.listMember != null) { return true; } |
| | | |
| | | //主账号需要去获取成员列表,而子账号只能他自己 |
| | | if (DB_ResidenceData.Instance.CurrentRegion.IsOthreShare == false) |
| | | { |
| | | //获取成员列表 |
| | | var responePack = new DAL.Server.HttpServerRequest().GetResidenceMemberAccount(); |
| | | if (responePack.Code == DAL.Server.StateCode.SUCCESS) |
| | | { |
| | | this.listMember = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ResidenceMemberInfo>>(responePack.Data.ToString()); |
| | | } |
| | | //失败 |
| | | else |
| | | { |
| | | //提示 |
| | | DAL.Server.IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //先初始化 |
| | | this.listMember = new List<ResidenceMemberInfo>(); |
| | | } |
| | | |
| | | //自身加进去,自己位于首位 |
| | | var info = new ResidenceMemberInfo(); |
| | | info.childAccountId = OnAppConfig.Instance.LastLoginUserId; |
| | | info.childAccountType = DB_ResidenceData.Instance.CurrentRegion.IsOthreShare == false ? "ADMIN" : "ORDINARY"; |
| | | info.nickName = UserInfo.Current.userName; |
| | | this.listMember.Insert(0, info); |
| | | if (string.IsNullOrEmpty(info.nickName)) |
| | | { |
| | | info.nickName = UserInfo.Current.AccountString; |
| | | } |
| | | |
| | | foreach (var info2 in this.listMember) |
| | | { |
| | | //设置用户昵称 |
| | | if (string.IsNullOrEmpty(info2.nickName)) |
| | | { |
| | | info2.nickName = info2.memberName; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 一键开锁___________________________ |
| | | |
| | | /// <summary> |
| | | /// 一键开锁 |
| | | /// </summary> |
| | | private void DoOneKeyToUnlockDoor() |
| | | { |
| | | if (this.doorLockData.IsOnline == false) |
| | | { |
| | | //设备不在线 |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.TipRemind, Language.StringByID(StringId.DeviceNotOnline), null, null, null, 2); |
| | | return; |
| | | } |
| | | //第一次使用,请先绑定门锁密码 |
| | | //HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.PleaseBindTheDoorPswFirst), () => |
| | | //{ |
| | | // var form = new TextInputDialog(Language.StringByID(StringId.PleaseInputDoorAdminPassword), string.Empty, Language.StringByID(StringId.PleaseInputDoorAdminPassword), null, null, true); |
| | | // form.Show((password) => |
| | | // { |
| | | // //门锁绑定成功 |
| | | // HdlMessageLogic.Current.ShowMassage(ShowMsgType.ConfirmSuccess, Language.StringByID(StringId.BindDoorLockSuccess), () => |
| | | // { |
| | | // }); |
| | | // }); |
| | | //}); |
| | | |
| | | if (UserInfo.Current.appUnlockPage.Contains("3") == true) |
| | | { |
| | | //调起安全认证 |
| | | HdlCheckLogic.Current.CheckUnlockSecurity(true, () => |
| | | { |
| | | //锁已打开 |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.TipSuccess, Language.StringByID(StringId.LockIsOpened), null, null, null, 2); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //为了安全,请跳转至个人中心{0}设置个人密码,并应用于门锁开锁 |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.JumpToPersonalCentetToSetPasswordMsg), () => |
| | | { |
| | | var page = new AppUnlockSettingsPage(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | }, Language.StringByID(StringId.Jump)); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新当前设备的状态缓存 |
| | | /// </summary> |
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) |
| | | { |
| | | this.doorLockData.IsOnline = i_LocalDevice.online; |
| | | for (int i = 0; i < i_LocalDevice.attributes.Count; i++) |
| | | { |
| | | var data = i_LocalDevice.attributes[i]; |
| | | //门锁状态 |
| | | if (data.key == "status") |
| | | { |
| | | if (data.state == "open") { this.doorLockData.Open = true; } |
| | | else if (data.state == "normal_open") |
| | | { |
| | | //常开模式 |
| | | this.doorLockData.Open = true; |
| | | this.doorLockData.NormalOpen = true; |
| | | } |
| | | else |
| | | { |
| | | this.doorLockData.Open = false; |
| | | this.doorLockData.NormalOpen = false; |
| | | } |
| | | } |
| | | //音量 |
| | | else if (data.key == "volume") |
| | | { |
| | | var value = data.state; |
| | | if (value != string.Empty) |
| | | { |
| | | this.doorLockData.Voice = Convert.ToInt32(value); |
| | | } |
| | | } |
| | | //电池百分比 |
| | | else if (data.key == "battery_percentage") |
| | | { |
| | | var value = data.state; |
| | | if (value != string.Empty) |
| | | { |
| | | this.doorLockData.BatteryPersent = Convert.ToInt32(value); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 结构体_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 门锁的数据 |
| | | /// </summary> |
| | | private class DoorLockData |
| | | { |
| | | /// <summary> |
| | | /// 是否打开 |
| | | /// </summary> |
| | | public bool Open = true; |
| | | /// <summary> |
| | | /// 电池电量 |
| | | /// </summary> |
| | | public int BatteryPersent = 0; |
| | | /// <summary> |
| | | /// 是否在线 |
| | | /// </summary> |
| | | public bool IsOnline = false; |
| | | /// <summary> |
| | | /// 是否静音 |
| | | /// </summary> |
| | | public bool Mute = false; |
| | | /// <summary> |
| | | /// 音量 |
| | | /// </summary> |
| | | public int Voice = 0; |
| | | /// <summary> |
| | | /// 是否处于常开模式 |
| | | /// </summary> |
| | | public bool NormalOpen = false; |
| | | /// <summary> |
| | | /// 临时密码 |
| | | /// </summary> |
| | | public string TempPassword = string.Empty; |
| | | /// <summary> |
| | | /// 临时密码是否被变更 |
| | | /// </summary> |
| | | public bool IsTempPasswordChanged = true; |
| | | /// <summary> |
| | | /// 临时密码生效时间(2020.03.17 13:27) |
| | | /// </summary> |
| | | public string StatrtTime = string.Empty; |
| | | /// <summary> |
| | | /// 临时密码失效时间(2020.03.17 13:27) |
| | | /// </summary> |
| | | public string EndTime = string.Empty; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁的选择日期时间界面 |
| | | /// </summary> |
| | | public class DoorLockSelectTimePage : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 选择结束的事件 |
| | | /// </summary> |
| | | public Action<DateTime> SelectFinshEvent = null; |
| | | /// <summary> |
| | | /// 选择的时间 |
| | | /// </summary> |
| | | private DateTime selectDateTime; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | /// <param name="i_dateTime">一个时间</param> |
| | | public void ShowForm(DateTime i_dateTime) |
| | | { |
| | | this.selectDateTime = i_dateTime; |
| | | |
| | | //选择时间 |
| | | base.SetTitleText(Language.StringByID(StringId.SelectTime)); |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | //选择日期 |
| | | var rowDate = new RowLayoutControl(); |
| | | rowDate.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | bodyFrameLayout.AddChidren(rowDate); |
| | | rowDate.frameTable.AddLeftCaption(Language.StringByID(StringId.SelectDate), 300); |
| | | rowDate.frameTable.AddRightArrow(); |
| | | rowDate.frameTable.AddBottomLine(); |
| | | var btnDay = rowDate.frameTable.AddMostRightView(this.selectDateTime.ToString("yyyy.MM.dd"), 300); |
| | | rowDate.frameTable.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //显示日期选择的底部弹窗 |
| | | var contr = new BottomDateSelectControl(); |
| | | contr.InitControl(this.selectDateTime.Year, this.selectDateTime.Month, this.selectDateTime.Day, 1, 1); |
| | | contr.FinishEvent += (div, year, month, day) => |
| | | { |
| | | //覆盖时间 |
| | | if (div == 1) |
| | | { |
| | | this.selectDateTime = new DateTime(year, month, day, this.selectDateTime.Hour, this.selectDateTime.Minute, 0); |
| | | btnDay.Text = this.selectDateTime.ToString("yyyy.MM.dd"); |
| | | } |
| | | }; |
| | | }; |
| | | |
| | | //选择时间 |
| | | var rowTime = new RowLayoutControl(); |
| | | rowTime.Y = rowDate.Bottom; |
| | | rowTime.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | bodyFrameLayout.AddChidren(rowTime); |
| | | rowTime.frameTable.AddLeftCaption(Language.StringByID(StringId.SelectTime), 300); |
| | | rowTime.frameTable.AddRightArrow(); |
| | | var btnTime = rowTime.frameTable.AddMostRightView(this.selectDateTime.ToString("HH:mm"), 300); |
| | | rowTime.frameTable.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //显示日期选择的底部弹窗 |
| | | var contr = new BottomTimeSelectControl(); |
| | | contr.RowCount = 5; |
| | | contr.InitControl(this.selectDateTime.Hour, this.selectDateTime.Minute, -1); |
| | | contr.FinishEvent += (div, hour, minute) => |
| | | { |
| | | //覆盖时间 |
| | | if (div == 1) |
| | | { |
| | | this.selectDateTime = new DateTime(this.selectDateTime.Year, this.selectDateTime.Month, this.selectDateTime.Day, hour, minute, 0); |
| | | btnTime.Text = this.selectDateTime.ToString("HH:mm"); |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 界面关闭___________________________ |
| | | |
| | | /// <summary> |
| | | /// 界面关闭 |
| | | /// </summary> |
| | | public override void CloseFormBefore() |
| | | { |
| | | base.CloseFormBefore(); |
| | | //调用回调事件 |
| | | this.SelectFinshEvent?.Invoke(this.selectDateTime); |
| | | this.SelectFinshEvent = null; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.DAL.Server; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 门锁的选择日期时间界面 |
| | | /// </summary> |
| | | public class DoorLockUnlockMethordManagerPage : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 列表控件 |
| | | /// </summary> |
| | | private VerticalFrameControl listView = null; |
| | | /// <summary> |
| | | /// 开锁方式列表 |
| | | /// </summary> |
| | | private List<UnlockMethordInfo> listUnlockInfo = new List<UnlockMethordInfo>(); |
| | | /// <summary> |
| | | /// 成员列表 |
| | | /// </summary> |
| | | private List<ResidenceMemberInfo> listMember = null; |
| | | /// <summary> |
| | | /// 白色背景的容器控件集合(坐标变更时使用) |
| | | /// </summary> |
| | | private List<NormalFrameLayout> listWhiteFrame = new List<NormalFrameLayout>(); |
| | | /// <summary> |
| | | /// 选择的场景(key:门锁的数据库主键 value:场景列表的主键) |
| | | /// </summary> |
| | | private Dictionary<string, List<string>> dicSelectScene = new Dictionary<string, List<string>>(); |
| | | /// <summary> |
| | | /// 门锁对象 |
| | | /// </summary> |
| | | private Function doorDevice = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | /// <param name="i_doorDevice">门锁对象</param> |
| | | /// <param name="i_listMember">成员列表</param> |
| | | public void ShowForm(Function i_doorDevice, List<ResidenceMemberInfo> i_listMember) |
| | | { |
| | | this.doorDevice = i_doorDevice; |
| | | this.listMember = i_listMember; |
| | | this.dicSelectScene = new Dictionary<string, List<string>>(); |
| | | |
| | | //开锁方式管理 |
| | | base.SetTitleText(Language.StringByID(StringId.UnlockingManagement)); |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | //列表控件 |
| | | this.listView = new VerticalFrameControl(); |
| | | listView.Height = bodyFrameLayout.Height; |
| | | bodyFrameLayout.AddChidren(listView); |
| | | |
| | | //打开转圈的那个东西 |
| | | this.ShowProgressBar(); |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | //初始化开锁方式信息列表 |
| | | var result = this.InitUnlockMethordInfoFromClound(); |
| | | //关闭转圈的那个东西 |
| | | this.CloseProgressBar(); |
| | | if (result == false) |
| | | { |
| | | return; |
| | | } |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //初始化未分配控件 |
| | | this.InitNotAssignControl(); |
| | | //初始化全部成员控件 |
| | | this.InitAllMemberControl(); |
| | | //调整桌布大小 |
| | | this.listView.AdjustTableHeight(); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化未分配控件___________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化未分配控件 |
| | | /// </summary> |
| | | private void InitNotAssignControl() |
| | | { |
| | | //先初始化 |
| | | this.listWhiteFrame = new List<NormalFrameLayout>(); |
| | | |
| | | //获取未分配的开锁方式 |
| | | var listInfo = new List<UnlockMethordInfo>(); |
| | | foreach (var info in this.listUnlockInfo) |
| | | { |
| | | if (info.UserId != string.Empty) |
| | | { |
| | | continue; |
| | | } |
| | | listInfo.Add(info); |
| | | } |
| | | //白色背景容器 |
| | | var frameBack = new NormalFrameLayout(); |
| | | frameBack.Y = Application.GetRealHeight(12); |
| | | frameBack.Width = Application.GetRealWidth(343); |
| | | frameBack.Gravity = Gravity.CenterHorizontal; |
| | | frameBack.MainKey = "NotAssign"; |
| | | frameBack.Radius = (uint)Application.GetRealWidth(12); |
| | | frameBack.Height = Application.GetRealHeight(50); |
| | | frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | frameBack.Visible = listInfo.Count > 0; |
| | | this.listView.frameTable.AddChidren(frameBack); |
| | | this.listWhiteFrame.Add(frameBack); |
| | | |
| | | //未分配 |
| | | var frameRow = new FrameRowControl(); |
| | | frameBack.AddChidren(frameRow); |
| | | var btnNotAssign = frameRow.AddLeftCaption(Language.StringByID(StringId.Unallocated), 300); |
| | | btnNotAssign.TextSize = CSS_FontSize.SubheadingFontSize; |
| | | btnNotAssign.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | frameRow.AddBottomLine(); |
| | | |
| | | for (int i = 0; i < listInfo.Count; i++) |
| | | { |
| | | //添加密码行控件 |
| | | this.AddUnlockPasswordRowControl(frameBack, listInfo[i], i != listInfo.Count - 1); |
| | | } |
| | | //调整桌布高度 |
| | | listView.AdjustChidrenFrameHeight(frameBack, 0); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化成员控件_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化全部成员控件 |
| | | /// </summary> |
| | | private void InitAllMemberControl() |
| | | { |
| | | //头像列表 |
| | | var listIcon = new List<ImageView>(); |
| | | foreach (var info in this.listMember) |
| | | { |
| | | //根据成员信息初始化成员控件 |
| | | var btnIcon = this.InitMemberControlByMemberInfo(info); |
| | | listIcon.Add(btnIcon); |
| | | } |
| | | //再加一个空白间隙 |
| | | var frameSpace = new NormalFrameLayout(); |
| | | frameSpace.Height = Application.GetRealHeight(12); |
| | | frameSpace.Y = this.listView.frameTable.GetChildren(this.listView.frameTable.ChildrenCount - 1).Bottom; |
| | | this.listView.frameTable.AddChidren(frameSpace); |
| | | this.listWhiteFrame.Add(frameSpace); |
| | | |
| | | //下载用户头像 |
| | | this.DownLoadUserIcon(listIcon); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据成员信息初始化成员控件 |
| | | /// </summary> |
| | | private ImageView InitMemberControlByMemberInfo(ResidenceMemberInfo memberInfo) |
| | | { |
| | | //获取分配给这个成员的开锁方式 |
| | | var listInfo = new List<UnlockMethordInfo>(); |
| | | foreach (var info in this.listUnlockInfo) |
| | | { |
| | | if (info.UserId != memberInfo.childAccountId) |
| | | { |
| | | continue; |
| | | } |
| | | listInfo.Add(info); |
| | | } |
| | | |
| | | //白色背景容器 |
| | | var frameBack = new NormalFrameLayout(); |
| | | frameBack.Width = Application.GetRealWidth(343); |
| | | if (listInfo.Count > 0) |
| | | { |
| | | frameBack.Y = this.listView.frameTable.GetChildren(this.listView.frameTable.ChildrenCount - 1).Bottom + Application.GetRealHeight(12); |
| | | } |
| | | else |
| | | { |
| | | //如果没有开锁方式,则暂时隐藏 |
| | | frameBack.Visible = false; |
| | | } |
| | | frameBack.Gravity = Gravity.CenterHorizontal; |
| | | frameBack.MainKey = memberInfo.childAccountId; |
| | | frameBack.Radius = (uint)Application.GetRealWidth(12); |
| | | frameBack.Height = Application.GetRealHeight(80); |
| | | frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | this.listView.frameTable.AddChidren(frameBack); |
| | | this.listWhiteFrame.Add(frameBack); |
| | | |
| | | //用户行 |
| | | var frameUserRow = new FrameRowControl(); |
| | | frameUserRow.Width = frameBack.Width; |
| | | frameUserRow.Height = Application.GetRealHeight(80); |
| | | frameBack.AddChidren(frameUserRow); |
| | | //用户头像 |
| | | var btnUserIcon = new ImageView(); |
| | | btnUserIcon.X = HdlControlResourse.XXLeft; |
| | | btnUserIcon.Width = Application.GetRealWidth(48); |
| | | btnUserIcon.Height = Application.GetRealWidth(48); |
| | | btnUserIcon.Gravity = Gravity.CenterVertical; |
| | | btnUserIcon.ImagePath = "LoginIcon/2.png"; |
| | | btnUserIcon.Radius = (uint)btnUserIcon.Height / 2; |
| | | frameUserRow.AddChidren(btnUserIcon, ChidrenBindMode.NotBind); |
| | | //用户名 |
| | | var btnUserName = frameUserRow.AddLeftCaption(memberInfo.nickName, 150); |
| | | btnUserName.X = btnUserIcon.Right + Application.GetRealWidth(12); |
| | | btnUserName.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | //底线 |
| | | frameUserRow.AddBottomLine(); |
| | | //成员身份背景图片 |
| | | var frameUserType = new FrameLayout(); |
| | | frameUserType.X = Application.GetRealWidth(220); |
| | | frameUserType.Y = Application.GetRealHeight(16); |
| | | frameUserType.Height = Application.GetRealHeight(58); |
| | | frameUserType.Width = Application.GetRealWidth(180); |
| | | frameUserType.BackgroundImagePath = "PersonalCenter/UserTypebg2.png";//用最长图标的那个 |
| | | frameUserRow.AddChidren(frameUserType, ChidrenBindMode.NotBind); |
| | | //成员身份翻译 |
| | | var btnUserTypeName = new NormalViewControl(270, 54, true); |
| | | btnUserTypeName.X = Application.GetRealWidth(35); |
| | | btnUserTypeName.Y = Application.GetRealHeight(-2); |
| | | btnUserTypeName.TextColor = CSS_Color.MainBackgroundColor; |
| | | btnUserTypeName.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnUserTypeName.TextID = memberInfo.childAccountType == "ADMIN" ? StringId.Administrators : StringId.Member; |
| | | btnUserTypeName.Width = btnUserTypeName.GetRealWidthByText(); |
| | | frameUserType.AddChidren(btnUserTypeName); |
| | | //按照控件实际长度,变更背景图的X轴 Application.GetRealWidth(10)为右边余白 |
| | | frameUserType.X = frameBack.Width - btnUserTypeName.X - btnUserTypeName.Width - Application.GetRealWidth(10); |
| | | |
| | | for (int i = 0; i < listInfo.Count; i++) |
| | | { |
| | | //添加密码行控件 |
| | | this.AddUnlockPasswordRowControl(frameBack, listInfo[i], i != listInfo.Count - 1); |
| | | } |
| | | //调整桌布高度 |
| | | listView.AdjustChidrenFrameHeight(frameBack, 0); |
| | | |
| | | return btnUserIcon; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 生成密码行控件_____________________ |
| | | |
| | | /// <summary> |
| | | /// 生成密码行控件 |
| | | /// </summary> |
| | | /// <param name="frameFather">父控件</param> |
| | | /// <param name="unlockInfo">开锁方式信息</param> |
| | | /// <param name="addLine">是否添加底线</param> |
| | | private void AddUnlockPasswordRowControl(NormalFrameLayout frameFather, UnlockMethordInfo unlockInfo, bool addLine) |
| | | { |
| | | //行控件 |
| | | var frameRow = new FrameRowControl(); |
| | | frameRow.MainKey = unlockInfo.Id; |
| | | frameRow.RightOffset = Application.GetRealWidth(-32); |
| | | if (frameFather.ChildrenCount > 0) |
| | | { |
| | | //往最底下添加 |
| | | frameRow.Y = frameFather.GetChildren(frameFather.ChildrenCount - 1).Bottom; |
| | | } |
| | | frameFather.AddChidren(frameRow); |
| | | if (addLine == true) |
| | | { |
| | | frameRow.AddBottomLine(); |
| | | } |
| | | |
| | | //开锁方式备注 |
| | | var btnCaption = frameRow.AddLeftCaption(unlockInfo.Remark, 120); |
| | | btnCaption.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | |
| | | //场景联动图标 |
| | | IconViewControl btnScene = null; |
| | | //备注编辑图标 |
| | | IconViewControl btnEditor = null; |
| | | //分配图标 |
| | | IconViewControl btnMove = null; |
| | | //删除图标 |
| | | IconViewControl btnDelete = null; |
| | | //更多图标 |
| | | var btnMore = frameRow.AddMostRightEmptyIcon(28, 28); |
| | | btnMore.UnSelectedImagePath = "FunctionIcon/DoorLock/More.png"; |
| | | btnMore.SelectedImagePath = "FunctionIcon/DoorLock/Hide.png"; |
| | | btnMore.ButtonClickEvent += (sender, e) => |
| | | { |
| | | btnMore.IsSelected = !btnMore.IsSelected; |
| | | btnEditor.Visible = btnMore.IsSelected; |
| | | btnMove.Visible = btnMore.IsSelected; |
| | | btnDelete.Visible = btnMore.IsSelected; |
| | | |
| | | //变更分享场景图标的X轴 |
| | | int intSceneX = btnMore.IsSelected == true ? btnEditor.X : btnMore.X; |
| | | btnScene.X = intSceneX - btnScene.Width - Application.GetRealWidth(12); |
| | | }; |
| | | //删除图标 |
| | | btnDelete = new IconViewControl(28); |
| | | btnDelete.UnSelectedImagePath = "FunctionIcon/DoorLock/Delete.png"; |
| | | btnDelete.Gravity = Gravity.CenterVertical; |
| | | btnDelete.X = btnMore.X - btnDelete.Width - Application.GetRealWidth(12); |
| | | btnDelete.Visible = false; |
| | | frameRow.AddChidren(btnDelete, ChidrenBindMode.NotBind); |
| | | btnDelete.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //删除操作将被同步于实体锁上{0}是否还需要删除? |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.DeleteUnlockingMethordMsg), () => |
| | | { |
| | | //删除开锁方式 |
| | | this.DeleteUnlockMethrod(frameFather, unlockInfo); |
| | | |
| | | }, Language.StringByID(StringId.ConfirmDeletion)); |
| | | }; |
| | | |
| | | //分配图标 |
| | | btnMove = new IconViewControl(28); |
| | | btnMove.UnSelectedImagePath = "FunctionIcon/DoorLock/Redistribution.png"; |
| | | btnMove.Gravity = Gravity.CenterVertical; |
| | | btnMove.X = btnDelete.X - btnMove.Width - Application.GetRealWidth(12); |
| | | btnMove.Visible = false; |
| | | frameRow.AddChidren(btnMove, ChidrenBindMode.NotBind); |
| | | btnMove.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //分配开锁方式 |
| | | this.DistributeUnlockMethord(frameFather, unlockInfo); |
| | | }; |
| | | |
| | | //编辑图标 |
| | | btnEditor = new IconViewControl(28); |
| | | btnEditor.UnSelectedImagePath = "FunctionIcon/DoorLock/Editor.png"; |
| | | btnEditor.Gravity = Gravity.CenterVertical; |
| | | btnEditor.X = btnMove.X - btnEditor.Width - Application.GetRealWidth(12); |
| | | btnEditor.Visible = false; |
| | | frameRow.AddChidren(btnEditor, ChidrenBindMode.NotBind); |
| | | btnEditor.ButtonClickEvent += (sender, e) => |
| | | { |
| | | new UI.PublicAssmebly().LoadDialog_EditParater(StringId.EditorRemarkName, btnCaption.Text,(textValue)=> |
| | | { |
| | | btnCaption.Text = textValue; |
| | | |
| | | }, StringId.RemarkNameCanNotEmpty, 0, new List<string>()); |
| | | }; |
| | | |
| | | //场景联动图标 |
| | | btnScene = new IconViewControl(28); |
| | | btnScene.UnSelectedImagePath = "FunctionIcon/DoorLock/BindScene.png"; |
| | | btnScene.Gravity = Gravity.CenterVertical; |
| | | btnScene.X = btnMore.X - btnScene.Width - Application.GetRealWidth(12); |
| | | frameRow.AddChidren(btnScene, ChidrenBindMode.NotBind); |
| | | btnScene.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //显示选择场景弹窗 |
| | | this.ShowSelectSceneDialog(unlockInfo); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 调整白色容器控件的坐标及高度_______ |
| | | |
| | | /// <summary> |
| | | /// 调整全部白色容器控件的坐标 |
| | | /// </summary> |
| | | private void AdjustAllWhiteFrameLocation() |
| | | { |
| | | //初始Y轴 |
| | | int defultYY = 0; |
| | | for (int i = 0; i < this.listWhiteFrame.Count; i++) |
| | | { |
| | | var frame = this.listWhiteFrame[i]; |
| | | //不显示的,不做处理 |
| | | if (frame.Visible == false) { continue; } |
| | | //白色容器间的间距为12,最后一个是余白,不需要再添加间距 |
| | | frame.Y = i != this.listWhiteFrame.Count - 1 ? defultYY + Application.GetRealHeight(12) : defultYY; |
| | | |
| | | defultYY = frame.Bottom; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调整白色容器控件的高度 |
| | | /// </summary> |
| | | /// <param name="frameFather">指定白色区域的容器控件</param> |
| | | private void AdjustWhiteFrameHeight(NormalFrameLayout frameFather) |
| | | { |
| | | if (frameFather.ChildrenCount == 1) |
| | | { |
| | | //如果这个容器里面已经没有了开锁方式,则将它置顶,并隐藏 |
| | | frameFather.Y = 0; |
| | | frameFather.Visible = false; |
| | | } |
| | | else |
| | | { |
| | | //从新计算它的高度 |
| | | var rowLast = frameFather.GetChildren(frameFather.ChildrenCount - 1); |
| | | frameFather.Height = rowLast.Bottom; |
| | | if (rowLast is FrameRowControl) |
| | | { |
| | | //将它的底线移除掉 |
| | | ((FrameRowControl)rowLast).RemoveBottomLine(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化开锁方式信息列表_____________ |
| | | |
| | | /// <summary> |
| | | /// 初始化开锁方式信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private bool InitUnlockMethordInfoFromClound() |
| | | { |
| | | //先初始优化 |
| | | this.listUnlockInfo = new List<UnlockMethordInfo>(); |
| | | |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | var unlockInfo = new UnlockMethordInfo(); |
| | | unlockInfo.Id = "MimaKey" + i.ToString(); |
| | | unlockInfo.Remark = "密码" + i; |
| | | this.listUnlockInfo.Add(unlockInfo); |
| | | } |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | var unlockInfo = new UnlockMethordInfo(); |
| | | unlockInfo.Id = "ZhiwenKey" + i.ToString(); |
| | | unlockInfo.Remark = "指纹" + i; |
| | | this.listUnlockInfo.Add(unlockInfo); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开锁方式信息 |
| | | /// </summary> |
| | | private class UnlockMethordInfo |
| | | { |
| | | /// <summary> |
| | | /// 数据库主键 |
| | | /// </summary> |
| | | public string Id = string.Empty; |
| | | /// <summary> |
| | | /// 密码备注 |
| | | /// </summary> |
| | | public string Remark = string.Empty; |
| | | /// <summary> |
| | | /// 用户账号id |
| | | /// </summary> |
| | | public string UserId = string.Empty; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 显示选择场景弹窗___________________ |
| | | |
| | | /// <summary> |
| | | /// 显示选择场景弹窗 |
| | | /// </summary> |
| | | /// <param name="unlockInfo">开锁方式</param> |
| | | private void ShowSelectSceneDialog(UnlockMethordInfo unlockInfo) |
| | | { |
| | | if (FunctionList.List.scenes.Count == 0) |
| | | { |
| | | //检测不到可供选择的场景 |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.NotHadCanSelectScene)); |
| | | return; |
| | | } |
| | | var listText = new List<string>(); |
| | | var listSelectIndex = new List<int>(); |
| | | var listSelect = new List<string>(); |
| | | if (this.dicSelectScene.ContainsKey(unlockInfo.Id) == true) |
| | | { |
| | | //当前已经选择了的场景 |
| | | listSelect = this.dicSelectScene[unlockInfo.Id]; |
| | | } |
| | | |
| | | for (int i = 0; i < FunctionList.List.scenes.Count; i++) |
| | | { |
| | | var info = FunctionList.List.scenes[i]; |
| | | listText.Add(info.name); |
| | | if (listSelect.Contains(info.userSceneId) == true) |
| | | { |
| | | //初始选择 |
| | | listSelectIndex.Add(i); |
| | | } |
| | | } |
| | | //调起弹窗 |
| | | var form = new BottomItemSelectControl(FunctionList.List.scenes.Count, Language.StringByID(StringId.SelectScene)); |
| | | form.AddRowMenu(listText, listSelectIndex); |
| | | form.FinishOnlyEvent += (div, selectIndex) => |
| | | { |
| | | if (div == 1) |
| | | { |
| | | this.dicSelectScene[unlockInfo.Id] = new List<string>(); |
| | | this.dicSelectScene[unlockInfo.Id].Add(FunctionList.List.scenes[selectIndex].userSceneId); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 删除开锁方式_______________________ |
| | | |
| | | /// <summary> |
| | | /// 删除开锁方式 |
| | | /// </summary> |
| | | /// <param name="frameFather">父控件</param> |
| | | /// <param name="unlockInfo">开锁信息</param> |
| | | private void DeleteUnlockMethrod(NormalFrameLayout frameFather, UnlockMethordInfo unlockInfo) |
| | | { |
| | | //移除指定开锁方式的行控件 |
| | | this.RemoveUnlockMethrodRowControl(frameFather, unlockInfo); |
| | | |
| | | //调整白色容器控件的高度 |
| | | this.AdjustWhiteFrameHeight(frameFather); |
| | | |
| | | //调整全部白色容器控件的坐标 |
| | | this.AdjustAllWhiteFrameLocation(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除指定开锁方式的行控件 |
| | | /// </summary> |
| | | /// <param name="frameFather">父控件</param> |
| | | /// <param name="unlockInfo">开锁信息</param> |
| | | private void RemoveUnlockMethrodRowControl(NormalFrameLayout frameFather, UnlockMethordInfo unlockInfo) |
| | | { |
| | | //从索引1开始,因为索引0是标题 |
| | | for (int i = 1; i < frameFather.ChildrenCount; i++) |
| | | { |
| | | var row = frameFather.GetChildren(i) as FrameRowControl; |
| | | if (row == null || row.MainKey != unlockInfo.Id) |
| | | { |
| | | //不是它 |
| | | continue; |
| | | } |
| | | //移除掉它 |
| | | row.RemoveFromParent(); |
| | | break; |
| | | } |
| | | //然后重新整一下全部行的Y轴 |
| | | int newYY = frameFather.GetChildren(0).Bottom; |
| | | for (int i = 1; i < frameFather.ChildrenCount; i++) |
| | | { |
| | | var row = frameFather.GetChildren(i) as FrameRowControl; |
| | | if (row == null) |
| | | { |
| | | //理论上应该不会 |
| | | continue; |
| | | } |
| | | row.Y = newYY; |
| | | newYY = row.Bottom; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 分配开锁方式_______________________ |
| | | |
| | | /// <summary> |
| | | /// 分配开锁方式 |
| | | /// </summary> |
| | | /// <param name="frameFather">父控件</param> |
| | | /// <param name="unlockInfo">开锁信息</param> |
| | | private void DistributeUnlockMethord(NormalFrameLayout frameFather, UnlockMethordInfo unlockInfo) |
| | | { |
| | | //如果是未分配的开锁方式,则弹起成员选择窗口 |
| | | if (frameFather.MainKey == "NotAssign") |
| | | { |
| | | var listText = new List<string>(); |
| | | foreach (var info in this.listMember) |
| | | { |
| | | listText.Add(info.nickName); |
| | | } |
| | | //调起弹窗 |
| | | var form = new BottomItemSelectControl(this.listMember.Count, Language.StringByID(StringId.AssignTo)); |
| | | form.AddRowMenu(listText, new List<int>()); |
| | | form.FinishOnlyEvent += (div, selectIndex) => |
| | | { |
| | | if (div == 1) |
| | | { |
| | | //移除指定开锁方式的行控件 |
| | | this.RemoveUnlockMethrodRowControl(frameFather, unlockInfo); |
| | | //调整白色容器控件的高度 |
| | | this.AdjustWhiteFrameHeight(frameFather); |
| | | //添加新的开锁方式行控件 |
| | | this.AddNewUnlockMethrodRowControl(this.listMember[selectIndex].childAccountId, unlockInfo); |
| | | //调整全部白色容器控件的坐标 |
| | | this.AdjustAllWhiteFrameLocation(); |
| | | //调整桌布高度 |
| | | listView.AdjustTableHeight(); |
| | | } |
| | | }; |
| | | } |
| | | //如果是成员的,则把它放回未分配 |
| | | else |
| | | { |
| | | //移除指定开锁方式的行控件 |
| | | this.RemoveUnlockMethrodRowControl(frameFather, unlockInfo); |
| | | //调整白色容器控件的高度 |
| | | this.AdjustWhiteFrameHeight(frameFather); |
| | | //添加新的开锁方式行控件到未分配 |
| | | this.AddNewUnlockMethrodRowControl("NotAssign", unlockInfo); |
| | | //调整全部白色容器控件的坐标 |
| | | this.AdjustAllWhiteFrameLocation(); |
| | | //调整桌布高度 |
| | | listView.AdjustTableHeight(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加新的开锁方式行控件 |
| | | /// </summary> |
| | | /// <param name="i_childId">userId</param> |
| | | /// <param name="unlockInfo">开锁方式信息</param> |
| | | private void AddNewUnlockMethrodRowControl(string i_childId, UnlockMethordInfo unlockInfo) |
| | | { |
| | | NormalFrameLayout fatherFrame = null; |
| | | foreach (var frame in this.listWhiteFrame) |
| | | { |
| | | //获取指定的父控件 |
| | | if (frame.MainKey != i_childId) { continue; } |
| | | fatherFrame = frame; |
| | | break; |
| | | } |
| | | //应该不会存在 |
| | | if (fatherFrame == null) { return; } |
| | | |
| | | if (fatherFrame.ChildrenCount > 1) |
| | | { |
| | | //先为最后一行画底线 |
| | | var lastRow = fatherFrame.GetChildren(fatherFrame.ChildrenCount - 1) as FrameRowControl; |
| | | lastRow?.AddBottomLine(); |
| | | } |
| | | else |
| | | { |
| | | //它可以显示出来了 |
| | | fatherFrame.Visible = true; |
| | | } |
| | | //向指定的容器添加开锁方式控件 |
| | | this.AddUnlockPasswordRowControl(fatherFrame, unlockInfo, true); |
| | | //调整白色容器控件的高度 |
| | | this.AdjustWhiteFrameHeight(fatherFrame); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 下载用户头像_______________________ |
| | | |
| | | /// <summary> |
| | | /// 下载用户头像 |
| | | /// </summary> |
| | | /// <param name="listIcon">头像控件列表,它的索引和this.listMember一致</param> |
| | | private void DownLoadUserIcon(List<ImageView> listIcon) |
| | | { |
| | | //索引0是当前的登陆账号 |
| | | listIcon[0].ImagePath = UserInfo.Current.headImagePagePath; |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | for (int i = 1; i < this.listMember.Count; i++) |
| | | { |
| | | var resultData = ImageUtlis.Current.DownHeadImageByImageKey(this.listMember[i].memberHeadIcon, true, this.listMember[i].childAccountRegionUrl); |
| | | if (this.Parent == null) |
| | | { |
| | | //界面已经关闭 |
| | | return; |
| | | } |
| | | if (resultData != null && resultData.Length > 0) |
| | | { |
| | | int nowIndex = i; |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | listIcon[nowIndex].ImageBytes = resultData; |
| | | }, ShowErrorMode.NO); |
| | | } |
| | | System.Threading.Thread.Sleep(200); |
| | | } |
| | | |
| | | }, ShowErrorMode.NO); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | }
|
| | | //请确认是否已实际重置滤芯并按{0}照说明书要求操作设备进行滤芯{0}寿命重新计时
|
| | | string msg = Language.StringByID(StringId.FilterElementResetMsg).Replace("{0}", "\r\n");
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | | //发送使能命令
|
| | | this.SendEnableComand(null, "filter_reset", "true");
|
| | |
| | | else
|
| | | {
|
| | | //开启需要确认
|
| | | this.ShowMassage(ShowMsgType.Confirm, i_resetMsg, () =>
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, i_resetMsg, () =>
|
| | | {
|
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|