old mode 100755
new mode 100644
| | |
| | | { |
| | | public class DoorLockCommonLayout : EditorCommonForm |
| | | { |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | public DoorLockCommonLayout() |
| | | { |
| | | |
| | | } |
| | | #region ◆ 变量申明__________________________ |
| | | public FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout }; |
| | | public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1921 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout }; |
| | | #region ◆ 底部有圆角布局__________________________ |
| | | #region 变量申明 |
| | | public new FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout }; |
| | | public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1925 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout }; |
| | | /// <summary> |
| | | /// 选中的开锁方式回调 |
| | | /// </summary> |
| | | public Action<string> ChooseUnlockMethodAction = null; |
| | | /// <summary> |
| | | /// 选中的开锁方式回调 |
| | | /// </summary> |
| | | public Action<int> UndateUnlockMethodAction = null; |
| | | #region 底部有圆角布局 |
| | | /// 背景阴影界面 |
| | | /// </summary> |
| | | public FrameLayout shadowRadiusFrameLayout = new FrameLayout { BackgroundColor = 0x0f000000 }; |
| | | public FrameLayout bottomRadiusFrameLayout1 = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(100), |
| | | Y = Application.GetRealHeight(930), |
| | | Radius = 17, |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | public FrameLayout bottomRadiusFrameLayout2 = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(806 - 50), |
| | | Y = Application.GetRealHeight(930 + 48), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | /// <summary> |
| | | /// 设置圆角的界面 |
| | | /// </summary> |
| | | public FrameLayout bottomRadiusFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(806), |
| | | Y = Application.GetRealHeight(930), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 底部圆角中的取消按钮 |
| | | /// </summary> |
| | | public Button btnCancel = new Button |
| | | { |
| | | X = Application.GetRealWidth(81), |
| | |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 14, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 底部圆角中的标题栏 |
| | | /// </summary> |
| | | public Button btnBottomTitle = new Button |
| | | { |
| | | X = Application.GetRealWidth(446 - 50), |
| | |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextSize = 16, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 底部圆角中的确认按钮 |
| | | /// </summary> |
| | | public Button btnFinish = new Button |
| | | { |
| | | X = Application.GetRealWidth(919), |
| | |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(101), |
| | | Text = Language.StringByID(R.MyInternationalizationString.Complete), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | /// <summary> |
| | | /// 底部圆角中的标题栏下的线条 |
| | | /// </summary> |
| | | public Button line = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(138), |
| | | Height = 1, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// ◆ 中部刷新布局__________________________ |
| | | /// </summary> |
| | | //public VerticalRefreshLayout midVerticalScrolViewLayout = new VerticalRefreshLayout() |
| | | //{ |
| | | //}; |
| | | |
| | | /// <summary> |
| | | /// ◆ 标题栏布局__________________________ |
| | | /// 标题栏布局 |
| | | /// </summary> |
| | | public FrameLayout titleFrameLayout = new FrameLayout |
| | | { |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTitleLine, |
| | | }; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 弹窗取消按键 |
| | | /// </summary> |
| | |
| | | topFrameLayout.AddChidren(btnBackFrameLayout); |
| | | topFrameLayout.AddChidren(titleFrameLayout); |
| | | topFrameLayout.AddChidren(btnTitleLine); |
| | | |
| | | var title = new Button() |
| | | { |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | |
| | | Width = Application.GetRealWidth(1080 - 161), |
| | | Height = Application.GetRealWidth(69), |
| | | TextSize = 17, |
| | | IsBold = true, |
| | | X = Application.GetRealWidth(161 - 116), |
| | | }; |
| | | titleFrameLayout.AddChidren(title); |
| | |
| | | /// <param name="frameLayout"></param> |
| | | public void BottomRadiusFrameLayout(FrameLayout frameLayout) |
| | | { |
| | | this.shadowRadiusFrameLayout.AddChidren(this.bottomRadiusFrameLayout1); |
| | | this.shadowRadiusFrameLayout.AddChidren(this.bottomRadiusFrameLayout2); |
| | | this.shadowRadiusFrameLayout.AddChidren(this.bottomRadiusFrameLayout); |
| | | this.bottomRadiusFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | this.bottomRadiusFrameLayout.AddChidren(btnCancel); |
| | | this.bottomRadiusFrameLayout.AddChidren(btnBottomTitle); |
| | | this.bottomRadiusFrameLayout.AddChidren(btnFinish); |
| | | this.bottomRadiusFrameLayout.AddChidren(line); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | var editInputPassword = new EditText() |
| | | { |
| | | X = Application.GetRealHeight(25), |
| | | X = Application.GetRealHeight(15), |
| | | TextSize = 13, |
| | | PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray4, |
| | | PlaceholderText = Language.StringByID(R.MyInternationalizationString.InputUnlockPasswrd), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextAlignment = TextAlignment.BottomLeft, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | IsNumberKeyboardType = true, |
| | | }; |
| | | editInputPasswordFrameLayout.AddChidren(editInputPassword); |
| | | |
| | |
| | | DateTime oldTime = DateTime.MaxValue; |
| | | doorDialog.dialogBtnConfirm.MouseUpEventHandler += async (sender1, e1) => |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | if (DateTime.Now < ZigBee.Device.DoorLock.minValue) |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoFiftySeconds), Direction = AMPopTipDirection.Down, CloseTime = 2 }.Show(editInputPassword); |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoFiftySeconds)); |
| | | return; |
| | | } |
| | | |
| | |
| | | ZigBee.Device.DoorLock.minValue = DateTime.Now.AddSeconds(+15); |
| | | oldTime = ZigBee.Device.DoorLock.minValue; |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AfterFiftySeconds), Direction = AMPopTipDirection.Down, CloseTime = 2 }.Show(editInputPassword); |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AfterFiftySeconds)); |
| | | return; |
| | | } |
| | | |
| | |
| | | ZigBee.Device.DoorLock.RemoteUnlockCount--; |
| | | string tipText = Language.StringByID(R.MyInternationalizationString.PasswordError) + "," + Language.StringByID(R.MyInternationalizationString.Surplus) + ZigBee.Device.DoorLock.RemoteUnlockCount.ToString() + Language.StringByID(R.MyInternationalizationString.Opportunity); |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = tipText, Direction = AMPopTipDirection.Down, CloseTime = 2 }.Show(editInputPassword); |
| | | this.ShowMassage(ShowMsgType.Tip, tipText); |
| | | return; |
| | | } |
| | | |
| | |
| | | { |
| | | if (verifyResult.result == 0) |
| | | { |
| | | ///保存远程门锁密码 |
| | | new Device.DeviceMacInfoEditorForm { }.SaveLocalPassword(editInputPassword.Text); |
| | | System.Threading.Thread.Sleep(500); |
| | | doorLock.RemoteUnlockPassword = editInputPassword.Text; |
| | | ZigBee.Device.DoorLock.minValue = DateTime.MinValue; |
| | |
| | | { |
| | | btnNext.IsSelected = true; |
| | | } |
| | | if (!UserCenterResourse.Option.DoorUnLockByRemote) |
| | | if (!UserCenterResourse.AccountOption.DoorUnLockByRemote) |
| | | { |
| | | var dialog2 = new Dialog { }; |
| | | var doorDialog2 = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog2, Language.StringByID(R.MyInternationalizationString.Tip)); |
| | | doorDialog2.Show(); |
| | | doorDialog2.dialogMidFraFrameLayout.Width = Application.GetRealWidth(674); |
| | | doorDialog2.dialogMidFraFrameLayout.Height = Application.GetRealHeight(115); |
| | | doorDialog2.dialogMidFraFrameLayout.X = Application.GetRealWidth(60); |
| | | doorDialog2.dialogMidFraFrameLayout.Y = Application.GetRealHeight(167); |
| | | doorDialog2.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.GoSetting); |
| | | var midText1 = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(674), |
| | | Height = Application.GetRealHeight(115 / 2), |
| | | TextSize = 14, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = R.MyInternationalizationString.RemoteUnlockBindSucessTip1, |
| | | }; |
| | | doorDialog2.dialogMidFraFrameLayout.AddChidren(midText1); |
| | | var midText2 = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(674), |
| | | Height = Application.GetRealHeight(115 / 2), |
| | | Y = Application.GetRealHeight(115 / 2), |
| | | TextSize = 14, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = R.MyInternationalizationString.RemoteUnlockBindSucessTip2, |
| | | }; |
| | | doorDialog2.dialogMidFraFrameLayout.AddChidren(midText2); |
| | | |
| | | doorDialog2.dialogBtnCancel.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | dialog2.Close(); |
| | | }; |
| | | doorDialog2.dialogBtnConfirm.MouseUpEventHandler += async (sender2, e2) => |
| | | string msg = Language.StringByID(R.MyInternationalizationString.RemoteUnlockBindSucessTip).Replace("{0}", "\r\n"); |
| | | var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.GoSetting)); |
| | | alert.Show(); |
| | | //使用确认型弹框时,的回调函数 |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | dialog2.Close(); |
| | | }; |
| | | } |
| | | doorLock.ReSave(); |
| | |
| | | ZigBee.Device.DoorLock.RemoteUnlockCount--; |
| | | string tipText = Language.StringByID(R.MyInternationalizationString.OperrateFailed) + "," + Language.StringByID(R.MyInternationalizationString.Surplus) + ZigBee.Device.DoorLock.RemoteUnlockCount.ToString() + Language.StringByID(R.MyInternationalizationString.Opportunity); |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = tipText, Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1); |
| | | this.ShowMassage(ShowMsgType.Tip, tipText); |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1); |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.GwResponseOvertime)); |
| | | return; |
| | | } |
| | | }; |
| | |
| | | /// </summary> |
| | | /// <param name="doorLock">门锁设备</param> |
| | | /// <param name="action">二次验证的结果成功后的通知</param> |
| | | public static void SecurityRequest(ZigBee.Device.DoorLock doorLock, Action action) |
| | | public static void SecurityRequest(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | var dialog2 = new Dialog { }; |
| | | var doorDialog2 = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog2, Language.StringByID(R.MyInternationalizationString.Tip)); |
| | | doorDialog2.Show(); |
| | | doorDialog2.dialogMidFraFrameLayout.Width = Application.GetRealWidth(674); |
| | | doorDialog2.dialogMidFraFrameLayout.Height = Application.GetRealHeight(115); |
| | | doorDialog2.dialogMidFraFrameLayout.X = Application.GetRealWidth(60); |
| | | doorDialog2.dialogMidFraFrameLayout.Y = Application.GetRealHeight(167); |
| | | doorDialog2.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.GoSetting); |
| | | var midText1 = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(674), |
| | | Height = Application.GetRealHeight(115 / 2), |
| | | TextSize = 14, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = R.MyInternationalizationString.GoPersonalCenter, |
| | | }; |
| | | doorDialog2.dialogMidFraFrameLayout.AddChidren(midText1); |
| | | var midText2 = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(674), |
| | | Height = Application.GetRealHeight(115 / 2), |
| | | Y = Application.GetRealHeight(115 / 2), |
| | | TextSize = 14, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = R.MyInternationalizationString.OpenRemoteVerification, |
| | | }; |
| | | doorDialog2.dialogMidFraFrameLayout.AddChidren(midText2); |
| | | |
| | | doorDialog2.dialogBtnCancel.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | dialog2.Close(); |
| | | }; |
| | | doorDialog2.dialogBtnConfirm.MouseUpEventHandler += async (sender2, e2) => |
| | | string msg = Language.StringByID(R.MyInternationalizationString.SetSecondarySecurityVerificationMode).Replace("{0}", "\r\n"); |
| | | var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.GoSetting)); |
| | | alert.Show(); |
| | | //使用确认型弹框时,的回调函数 |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | dialog2.Close(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定远程开锁权限窗口 |
| | | /// </summary> |
| | | /// <param name="doorLock"></param> |
| | | /// <param name="btnDoorLockTitle"></param> |
| | | public void BindRemoteUnlockDoorlock(Room room, CommonDevice devDoorLock, Button btnDoorLockTitle = null) |
| | | { |
| | | ZigBee.Device.DoorLock doorLock = devDoorLock as ZigBee.Device.DoorLock; |
| | | string msgRemoteUnlockRequest = Language.StringByID(R.MyInternationalizationString.BindRemoteUnlockDoorlock); |
| | | var alertRemoteUnlockRequest = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msgRemoteUnlockRequest, Language.StringByID(R.MyInternationalizationString.GoSetting)); |
| | | alertRemoteUnlockRequest.Show(); |
| | | //使用确认型弹框时,的回调函数 |
| | | alertRemoteUnlockRequest.ConfirmClickEvent += () => |
| | | { |
| | | var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(room, devDoorLock); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | functionSetting.Show(); |
| | | functionSetting.devicNameAction += (deviceRename) => |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | { |
| | | if (btnDoorLockTitle != null) |
| | | { |
| | | btnDoorLockTitle.Text = deviceRename; |
| | | } |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 去个人中心,开启系统密码支持开锁权限 |
| | | /// </summary> |
| | | public void SystemSecondAuthentication() |
| | | { |
| | | string msgDoorUnLockByRemote = Language.StringByID(R.MyInternationalizationString.GoPersonalCenter).Replace("{0}", "\r\n"); |
| | | var alertDoorUnLockByRemote = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msgDoorUnLockByRemote, Language.StringByID(R.MyInternationalizationString.GoSetting)); |
| | | alertDoorUnLockByRemote.Show(); |
| | | //使用确认型弹框时,的回调函数 |
| | | alertDoorUnLockByRemote.ConfirmClickEvent += () => |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | }; |
| | | } |
| | | |
| | |
| | | /// <param name="action">二次验证的结果成功后的通知</param> |
| | | /// <param name="progressButton">门锁开或关时进度显示</param> |
| | | /// <param name="btnDoorLockPic">门锁图片开/关显示</param> |
| | | public void RemoteUnlockRequest(ZigBee.Device.DoorLock doorLock, Action action, Button progressButton = null, Button btnDoorLockPic = null, Button btnStatus = null, Button btnDoorLockTitle = null) |
| | | public void RemoteUnlockRequest(Room room, CommonDevice devDoorLock, Action action, Button progressButton = null, Button btnDoorLockPic = null, Button btnStatus = null, Button btnDoorLockTitle = null) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | ZigBee.Device.DoorLock doorLock = devDoorLock as ZigBee.Device.DoorLock; |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | var dialog = new Dialog { }; |
| | | var doorDialog = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog, Language.StringByID(R.MyInternationalizationString.Tip)); |
| | | doorDialog.Show(); |
| | | doorDialog.dialogMidFraFrameLayout.Width = Application.GetRealWidth(415); |
| | | doorDialog.dialogMidFraFrameLayout.Height = Application.GetRealHeight(58); |
| | | doorDialog.dialogMidFraFrameLayout.X = Application.GetRealWidth(190); |
| | | doorDialog.dialogMidFraFrameLayout.Y = Application.GetRealHeight(202); |
| | | doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText); |
| | | doorDialog.dialogMidText.Text = Language.StringByID(R.MyInternationalizationString.BindRemoteUnlockDoorlock); |
| | | doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText); |
| | | doorDialog.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.GoSetting); |
| | | doorDialog.dialogBtnCancel.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | doorDialog.dialogBtnConfirm.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1) |
| | | { |
| | | var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | functionSetting.Show(); |
| | | functionSetting.devicNameAction += (deviceRename) => |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | { |
| | | if (btnDoorLockTitle != null) |
| | | { |
| | | btnDoorLockTitle.Text = deviceRename; |
| | | } |
| | | } |
| | | }; |
| | | dialog.Close(); |
| | | } |
| | | else |
| | | { |
| | | var functionSettingSub = new Shared.Phone.UserCenter.DoorLock.FunctionSettingSub(doorLock); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSettingSub); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | functionSettingSub.Show(); |
| | | functionSettingSub.devicNameAction += (deviceRename) => |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | { |
| | | if (btnDoorLockTitle != null) |
| | | { |
| | | btnDoorLockTitle.Text = deviceRename; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | dialog.Close(); |
| | | } |
| | | }; |
| | | BindRemoteUnlockDoorlock(room, devDoorLock, btnDoorLockTitle); |
| | | return; |
| | | } |
| | | |
| | | if (!UserCenterResourse.Option.DoorUnLockByRemote) |
| | | if (!UserCenterResourse.AccountOption.DoorUnLockByRemote) |
| | | { |
| | | var dialog2 = new Dialog { }; |
| | | var doorDialog2 = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog2, Language.StringByID(R.MyInternationalizationString.Tip)); |
| | | doorDialog2.Show(); |
| | | doorDialog2.dialogMidFraFrameLayout.Width = Application.GetRealWidth(674); |
| | | doorDialog2.dialogMidFraFrameLayout.Height = Application.GetRealHeight(115); |
| | | doorDialog2.dialogMidFraFrameLayout.X = Application.GetRealWidth(60); |
| | | doorDialog2.dialogMidFraFrameLayout.Y = Application.GetRealHeight(167); |
| | | doorDialog2.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.GoSetting); |
| | | var midText1 = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(674), |
| | | Height = Application.GetRealHeight(115 / 2), |
| | | TextSize = 14, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = R.MyInternationalizationString.GoPersonalCenter, |
| | | }; |
| | | doorDialog2.dialogMidFraFrameLayout.AddChidren(midText1); |
| | | var midText2 = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(674), |
| | | Height = Application.GetRealHeight(115 / 2), |
| | | Y = Application.GetRealHeight(115 / 2), |
| | | TextSize = 14, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = R.MyInternationalizationString.OpenRemoteVerification, |
| | | }; |
| | | doorDialog2.dialogMidFraFrameLayout.AddChidren(midText2); |
| | | |
| | | doorDialog2.dialogBtnCancel.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | dialog2.Close(); |
| | | }; |
| | | doorDialog2.dialogBtnConfirm.MouseUpEventHandler += async (sender2, e2) => |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | dialog2.Close(); |
| | | }; |
| | | SystemSecondAuthentication(); |
| | | return; |
| | | } |
| | | |
| | | var dialog3 = new Dialog { }; |
| | | var doorDialog3 = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog3, Language.StringByID(R.MyInternationalizationString.UnlockRequest)); |
| | | doorDialog3.Show(); |
| | | doorDialog3.dialogMidFraFrameLayout.Width = Application.GetRealWidth(415); |
| | | doorDialog3.dialogMidFraFrameLayout.Height = Application.GetRealHeight(58); |
| | | doorDialog3.dialogMidFraFrameLayout.X = Application.GetRealWidth(228); |
| | | doorDialog3.dialogMidFraFrameLayout.Y = Application.GetRealHeight(202); |
| | | doorDialog3.dialogMidFraFrameLayout.AddChidren(doorDialog3.dialogMidText); |
| | | doorDialog3.dialogMidText.Text = Language.StringByID(R.MyInternationalizationString.SureToOpenDoorLock); |
| | | doorDialog3.dialogMidFraFrameLayout.AddChidren(doorDialog3.dialogMidText); |
| | | doorDialog3.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.Confrim); |
| | | doorDialog3.dialogBtnCancel.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | dialog3.Close(); |
| | | }; |
| | | doorDialog3.dialogBtnConfirm.MouseUpEventHandler += (sender1, e1) => |
| | | string msg = Language.StringByID(R.MyInternationalizationString.SureToOpenDoorLock); |
| | | var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm)); |
| | | alert.Show(); |
| | | //使用确认型弹框时,的回调函数 |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | action = () => |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | |
| | | }); |
| | | //远程开锁 |
| | | var remoteControlResult = await doorLock.RemoteControlAsync(doorLock.RemoteUnlockPassword); |
| | | //开锁成功,返回默认响应 |
| | | |
| | | //远程开锁成功,返回默认响应 |
| | | if (remoteControlResult != null && remoteControlResult.responseData != null) |
| | | { |
| | | if (remoteControlResult.responseData.status == 0) |
| | |
| | | { |
| | | if (progressButton != null) |
| | | { |
| | | progressButton.Y = Application.GetRealHeight(347); |
| | | progressButton.Y = Application.GetRealHeight(10); |
| | | } |
| | | if (btnDoorLockPic != null) |
| | | { |
| | | btnDoorLockPic.IsSelected = false; |
| | | btnDoorLockPic.IsSelected = true; |
| | | } |
| | | if (btnStatus != null) |
| | | { |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.DoorLockOpen); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockSuccess), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1); |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Current) + Language.StringByID(R.MyInternationalizationString.DoorLockOpen); |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.UnlockSuccess)); |
| | | } |
| | | }); |
| | | //开锁成功,默认5秒后门锁自动关锁,根据不同的门锁可能时间不同,这里以“H06C”门锁给的时间 |
| | | System.Threading.Thread.Sleep(5000); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (progressButton != null) |
| | | { |
| | | progressButton.Y = Application.GetRealHeight(347); |
| | | } |
| | | if (btnDoorLockPic != null) |
| | | { |
| | | btnDoorLockPic.IsSelected = false; |
| | | } |
| | | if (btnStatus != null) |
| | | { |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose); |
| | | } |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1); |
| | | }); |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.UnlockFailed)); |
| | | } |
| | | } |
| | | //用于远程开锁的门锁中的密码被删除情况 |
| | | else if (remoteControlResult != null && remoteControlResult.IsPawDispear == true) |
| | | { |
| | | //远程开锁有3次连续操作失败的机会 |
| | | ZigBee.Device.DoorLock.failedCount--; |
| | | if (ZigBee.Device.DoorLock.failedCount != 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (progressButton != null) |
| | | { |
| | | progressButton.Y = Application.GetRealHeight(347); |
| | | } |
| | | if (btnDoorLockPic != null) |
| | | { |
| | | btnDoorLockPic.IsSelected = false; |
| | | } |
| | | if (btnStatus != null) |
| | | { |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose); |
| | | } |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1); |
| | | }); |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.UnlockFailed)); |
| | | } |
| | | else |
| | | { |
| | | //3次操作失败远程开锁失败后,重写设置远程开锁密码 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (progressButton != null) |
| | | { |
| | | progressButton.Y = Application.GetRealHeight(347); |
| | | } |
| | | if (btnDoorLockPic != null) |
| | | { |
| | | btnDoorLockPic.IsSelected = false; |
| | | } |
| | | if (btnStatus != null) |
| | | { |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose); |
| | | } |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.DoorlockPasswordDispear), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1); |
| | | CommonPage.Loading.Hide(); |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.DoorlockPasswordDispear)); |
| | | doorLock.RemoteUnlockPassword = ""; |
| | | dialog3.Close(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1) |
| | | var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(room, devDoorLock); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | functionSetting.Show(); |
| | | functionSetting.devicNameAction += (deviceRename) => |
| | | { |
| | | var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | functionSetting.Show(); |
| | | functionSetting.devicNameAction += (deviceRename) => |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | if (btnDoorLockTitle != null) |
| | | { |
| | | if (btnDoorLockTitle != null) |
| | | { |
| | | btnDoorLockTitle.Text = deviceRename; |
| | | } |
| | | btnDoorLockTitle.Text = deviceRename; |
| | | } |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | var functionSettingSub = new Shared.Phone.UserCenter.DoorLock.FunctionSettingSub(doorLock); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSettingSub); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | functionSettingSub.Show(); |
| | | functionSettingSub.devicNameAction += (deviceRename) => |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | { |
| | | if (btnDoorLockTitle != null) |
| | | { |
| | | btnDoorLockTitle.Text = deviceRename; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | } |
| | | }; |
| | | }); |
| | | } |
| | | } |
| | | //远程开锁失败的情况 |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (progressButton != null) |
| | | { |
| | | progressButton.Y = Application.GetRealHeight(347); |
| | | } |
| | | if (btnDoorLockPic != null) |
| | | { |
| | | btnDoorLockPic.IsSelected = false; |
| | | } |
| | | if (btnStatus != null) |
| | | { |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose); |
| | | } |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1); |
| | | }); |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.GwResponseOvertime)); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (progressButton != null) |
| | | { |
| | | progressButton.Y = Application.GetRealHeight(347); |
| | | } |
| | | if (btnDoorLockPic != null) |
| | | { |
| | | btnDoorLockPic.IsSelected = false; |
| | | } |
| | | if (btnStatus != null) |
| | | { |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose); |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Current) + Language.StringByID(R.MyInternationalizationString.CLose); |
| | | } |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | HdlCheckLogic.Current.CheckSecondarySecurity(action); |
| | | dialog3.Close(); |
| | | }; |
| | | } |
| | | // 获取到到名称更改回调通知 |
| | | public Action<string> devicNameSecAction; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 当前选中的开锁方式 |
| | | /// </summary> |
| | | /// <param name="btnAllMethod"></param> |
| | | /// <param name="btnMethodText"></param> |
| | | /// <param name="oldbutton"></param> |
| | | /// <param name="oldbuttonText"></param> |
| | | public void CurrentSelectUnlockMethod(Button btnAllMethod, Button btnMethodText, Button oldbutton, Button oldbuttonText) |
| | | { |
| | | btnAllMethod.IsSelected = true; |
| | | btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnMethodText.IsBold = true; |
| | | oldbutton = btnAllMethod; |
| | | oldbuttonText = btnMethodText; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示所有开锁方式的数据 |
| | | /// </summary> |
| | | /// <param name="curIndex"></param> |
| | | /// <param name="btnAllMethod"></param> |
| | | /// <param name="btnMethodText"></param> |
| | | public void DisplayAllUnlockMethod(ZigBee.Device.DoorLock doorLock, int curIndex, Button btnAllMethod, Button btnMethodText) |
| | | { |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(doorLock.DeviceAddr); |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); |
| | | if (curIndex == 0) |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/AllMethod.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/AllMethodOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); |
| | | } |
| | | else if (curIndex == 1) |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/Password.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/PasswordOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock); |
| | | } |
| | | else if (curIndex == 2) |
| | | { |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1F) |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock); |
| | | } |
| | | else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_HAT1B) |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock); |
| | | } |
| | | else |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock); |
| | | } |
| | | } |
| | | else if (curIndex == 3) |
| | | { |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1F) |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/faceId.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/faceIdOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock); |
| | | } |
| | | else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1TF) |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); |
| | | } |
| | | else |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); |
| | | } |
| | | } |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1TF) |
| | | { |
| | | if (curIndex == 4) |
| | | { |
| | | btnAllMethod.UnSelectedImagePath = "DoorLock/faceId.png"; |
| | | btnAllMethod.SelectedImagePath = "DoorLock/faceIdOn.png"; |
| | | btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //switch (curIndex) |
| | | //{ |
| | | // case 0: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/AllMethod.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/AllMethodOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); |
| | | // break; |
| | | // case 1: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/Password.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/PasswordOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock); |
| | | // break; |
| | | // case 2: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock); |
| | | // break; |
| | | // case 3: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); |
| | | // break; |
| | | // case 4: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/faceId.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/faceIdOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock); |
| | | // break; |
| | | // case 5: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock); |
| | | // break; |
| | | //} |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 侧边导航栏 |
| | | /// </summary> |
| | | public void SideslipFramelayout(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | #region sidelipFrameLayout UI |
| | | var dialog = new Dialog |
| | | { |
| | | }; |
| | | dialog.Show(); |
| | | |
| | | var flMain = new FrameLayout { BackgroundColor = 0x00000000 }; |
| | | dialog.AddChidren(flMain); |
| | | flMain.MouseUpEventHandler += (sender11, e11) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var sidelipFrameLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(449), |
| | | Y = Application.GetRealHeight(115 + 160), |
| | | X = Application.GetRealWidth(596), |
| | | BackgroundImagePath = "DoorLock/SideslipPic.png", |
| | | }; |
| | | flMain.AddChidren(sidelipFrameLayout); |
| | | |
| | | var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(28), |
| | | }; |
| | | sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); |
| | | #endregion |
| | | |
| | | Button oldbutton = null; |
| | | Button oldbuttonText = null; |
| | | int count = 1 + GetSupportType(doorLock); |
| | | sidelipFrameLayout.Height = Application.GetRealHeight(150) * count + Application.GetRealHeight(6); |
| | | sidelipVerticalScrolViewLayout.Height = Application.GetRealHeight(150) * count + Application.GetRealHeight(6); |
| | | for (var i = 0; i < count; i++) |
| | | { |
| | | #region rowFrameLayout UI |
| | | var rowFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(150), |
| | | X = Application.GetRealWidth(81), |
| | | }; |
| | | sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout); |
| | | |
| | | var btnAllMethod = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | Y = Application.GetRealHeight(35), |
| | | }; |
| | | rowFrameLayout.AddChidren(btnAllMethod); |
| | | |
| | | var btnMethodText = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(311), |
| | | Height = Application.GetRealHeight(58), |
| | | X = Application.GetRealWidth(92), |
| | | Y = Application.GetRealHeight(49), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnMethodText); |
| | | |
| | | var line2 = new Button() |
| | | { |
| | | Y = rowFrameLayout.Height - 1, |
| | | X = Application.GetRealWidth(81), |
| | | Width = Application.GetRealWidth(965), |
| | | Height = 1, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | }; |
| | | rowFrameLayout.AddChidren(line2); |
| | | if (i == count) |
| | | { |
| | | line2.Visible = false; |
| | | } |
| | | #endregion |
| | | |
| | | #region 数据处理 |
| | | EventHandler<MouseEventArgs> hander = (sender, e) => |
| | | { |
| | | if (!btnAllMethod.IsSelected) |
| | | { |
| | | if (oldbutton != null) |
| | | { |
| | | oldbutton.IsSelected = false; |
| | | } |
| | | if (oldbuttonText != null) |
| | | { |
| | | oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; |
| | | } |
| | | oldbutton = btnAllMethod; |
| | | oldbuttonText = btnMethodText; |
| | | |
| | | doorLock.ReSave(); |
| | | btnAllMethod.IsSelected = true; |
| | | oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | oldbuttonText.IsBold = true; |
| | | doorLock.currentUserDisplayMethod = btnMethodText.Text; |
| | | TypeRefresh(doorLock); |
| | | } |
| | | dialog.Close(); |
| | | }; |
| | | rowFrameLayout.MouseUpEventHandler += hander; |
| | | btnAllMethod.MouseUpEventHandler += hander; |
| | | btnMethodText.MouseUpEventHandler += hander; |
| | | |
| | | DisplayAllUnlockMethod(doorLock, i, btnAllMethod, btnMethodText); |
| | | |
| | | if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0) |
| | | { |
| | | CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0) |
| | | { |
| | | CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1) |
| | | { |
| | | CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2) |
| | | { |
| | | CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3) |
| | | { |
| | | CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FaceIDUnlock) && i == 4) |
| | | { |
| | | CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock) && i == 5) |
| | | { |
| | | CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 当前门锁支持的开锁类型个数 |
| | | /// </summary> |
| | | /// <param name="doorLock"></param> |
| | | /// <returns></returns> |
| | | public int GetSupportType(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | int count = 0; |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(doorLock.DeviceAddr); |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1F) |
| | | { |
| | | //AT1F有密码,感应卡,faceID |
| | | count = 3; |
| | | } |
| | | else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1T) |
| | | { |
| | | //AT1T有密码,指纹,感应卡 |
| | | count = 3; |
| | | } |
| | | else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1TF) |
| | | { |
| | | //AT1TF有密码,指纹,感应卡,faceID |
| | | count = 4; |
| | | } |
| | | else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_HAT1B) |
| | | { |
| | | //HAT1B密码、静脉纹、刷卡 |
| | | count = 3; |
| | | } |
| | | else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_HAT1T) |
| | | { |
| | | //HAT1T密码、指纹、刷卡 |
| | | count = 3; |
| | | } |
| | | else |
| | | { |
| | | //只有密码,指纹,感应卡 |
| | | count = 3; |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 类型区分 |
| | | /// </summary> |
| | | public void TypeRefresh(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) |
| | | { |
| | | UndateUnlockMethodAction?.Invoke(0); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock)) |
| | | { |
| | | UndateUnlockMethodAction?.Invoke(3); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock)) |
| | | { |
| | | UndateUnlockMethodAction?.Invoke(13); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FaceIDUnlock)) |
| | | { |
| | | UndateUnlockMethodAction?.Invoke(14); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock)) |
| | | { |
| | | UndateUnlockMethodAction?.Invoke(15); |
| | | } |
| | | else |
| | | { |
| | | UndateUnlockMethodAction?.Invoke(-1); |
| | | } |
| | | //每次调完清空 |
| | | UndateUnlockMethodAction = null; |
| | | } |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 显示错误信息窗口 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | public void ShowErrorMsg(string msg) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var contr = new ShowMsgControl(ShowMsgType.Error, msg); |
| | | contr.Show(); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示Tip信息窗口 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | public void ShowTipMsg(string msg) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | contr.Show(); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |