| | |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="doorLock"></param> |
| | | public UnLockMethod(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj) |
| | | public UnLockMethod(ZigBee.Device.DoorLock doorLock, MemberInfoRes accountObj) |
| | | { |
| | | this.doorLock = doorLock; |
| | | this.curAccountObj = accountObj; |
| | |
| | | /// <summary> |
| | | /// 当前账户 |
| | | /// </summary> |
| | | Shared.Phone.UserCenter.MemberInfoRes curAccountObj; |
| | | MemberInfoRes curAccountObj; |
| | | /// <summary> |
| | | /// 数据为空,UI显示的空图片 |
| | | /// </summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); |
| | | if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) |
| | | { |
| | | //数据如果在门锁上面是空的时候,数据也是没有的 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | }); |
| | | } |
| | | //☆マーク☆ |
| | | //var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); |
| | | //if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) |
| | | //{ |
| | | // //数据如果在门锁上面是空的时候,数据也是没有的 |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | // }); |
| | | //} |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | // 类型区分 |
| | | UndateUnlockMethodAction += (obj) => |
| | | { |
| | | RefreshList(obj); |
| | | }; |
| | | TypeRefresh(doorLock); |
| | | // 类型区分 |
| | | TypeRefresh(); |
| | | CommonPage.Loading.Hide(); |
| | | bodyView.EndHeaderRefreshing(); |
| | | }); |
| | |
| | | UnSelectedImagePath = "DoorLock/AddIcon.png", |
| | | }; |
| | | btnAddFrameLayout.AddChidren(btnAdd); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) |
| | | { |
| | | btnAdd.Width = 0; |
| | | } |
| | | btnAdd.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | if (doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] == true) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | } |
| | | else |
| | | { |
| | | var addUnLockMethod = new Shared.Phone.UserCenter.DoorLock.AddUnLockMethod(doorLock, curAccountObj); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(addUnLockMethod); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | addUnLockMethod.Show(); |
| | | } |
| | | //☆マーク☆ |
| | | //if (doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] == true) |
| | | //{ |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | //} |
| | | //else |
| | | //{ |
| | | // var addUnLockMethod = new Shared.Phone.UserCenter.DoorLock.AddUnLockMethod(doorLock, curAccountObj); |
| | | // Shared.Phone.UserView.HomePage.Instance.AddChidren(addUnLockMethod); |
| | | // Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | // addUnLockMethod.Show(); |
| | | //} |
| | | }; |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 3) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 3) |
| | | { |
| | | btnAddFrameLayout.Width = 0; |
| | | } |
| | |
| | | } |
| | | |
| | | MidFrameLayoutContent(); |
| | | if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) |
| | | { |
| | | CommonPage.Loading.Start("Loading..."); |
| | | ReadDoorLockUserInfo(); |
| | | } |
| | | else |
| | | { |
| | | RefreshList(); |
| | | } |
| | | //☆マーク☆ |
| | | //if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) |
| | | //{ |
| | | // CommonPage.Loading.Start("Loading..."); |
| | | // ReadDoorLockUserInfo(); |
| | | //} |
| | | //else |
| | | //{ |
| | | // RefreshList(); |
| | | //} |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FaceIDUnlock)) |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock)) |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock); |
| | | } |
| | | else |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); |
| | |
| | | |
| | | EventHandler<MouseEventArgs> handerSideLip = (sender, e) => |
| | | { |
| | | SideslipFramelayout(doorLock); |
| | | UndateUnlockMethodAction += (obj) => |
| | | { |
| | | RefreshList(obj); |
| | | }; |
| | | SideslipFramelayout(); |
| | | }; |
| | | btnNext.MouseUpEventHandler += handerSideLip; |
| | | btnAllMethod.MouseUpEventHandler += handerSideLip; |
| | |
| | | TextSize = 12, |
| | | }; |
| | | blankFrameLayout.AddChidren(btnPicTip1); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) |
| | | { |
| | | btnPicTip1.Width = 0; |
| | | } |
| | |
| | | foreach (var curUserId in doorLock.localDoorLockUserList.Keys) |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; |
| | | |
| | | if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser); |
| | | } |
| | | //☆マーク☆ |
| | | //if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | //{ |
| | | // continue; |
| | | //} |
| | | //else |
| | | //{ |
| | | // curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser); |
| | | //} |
| | | } |
| | | |
| | | if (curAccountDoorLockUserList.Count == 0) |
| | |
| | | continue; |
| | | } |
| | | break; |
| | | case 13: |
| | | if (curDoorLockUser.UnlockType != unlockMethod) |
| | | { |
| | | continue; |
| | | } |
| | | break; |
| | | case 14: |
| | | if (curDoorLockUser.UnlockType != unlockMethod) |
| | | { |
| | | continue; |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UnlockType != unlockMethod) |
| | | { |
| | |
| | | var btnicon = rowFrameLayout.frameTable.AddLeftIcon(); |
| | | btnicon.UnSelectedImagePath = "DoorLock/DoorLockUserPic.png"; |
| | | //上面门锁用户名称一行 |
| | | var memberText = ""; |
| | | if (string.IsNullOrEmpty(curAccountObj.UserName)) |
| | | { |
| | | memberText = curAccountObj.Account; |
| | | } |
| | | else |
| | | { |
| | | memberText = curAccountObj.UserName; |
| | | } |
| | | var memberText = curAccountObj.ShowName; |
| | | |
| | | //成员一行 |
| | | var btnaa = rowFrameLayout.frameTable.AddBottomView(memberText, 800); |
| | | var btnDoorlockUser = new EditText() |
| | |
| | | btndelete.ButtonClickEvent += (sender, e) => |
| | | { |
| | | string msg = Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod); |
| | | var alert = new Shared.Phone.UserCenter.ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm)); |
| | | var alert = new ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm)); |
| | | alert.Show(); |
| | | //使用确认型弹框时,的回调函数 |
| | | alert.ConfirmClickEvent += async () => |
| | |
| | | if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2) |
| | | { |
| | | var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) |
| | | { |
| | | deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | //☆マーク☆ |
| | | //deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | deleteDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | if (result.Code == HttpMessageEnum.A成功) |
| | | { |
| | | isSecondDel = false; |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | doorLock.localDoorLockUserList.Remove(curUserId); |
| | | doorLock.ReSave(); |
| | | UndateUnlockMethodAction += (obj) => |
| | | { |
| | | RefreshList(obj); |
| | | }; |
| | | TypeRefresh(doorLock); |
| | | TypeRefresh(); |
| | | } |
| | | } |
| | | else |
| | |
| | | if (isSecondDel) |
| | | { |
| | | var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) |
| | | { |
| | | deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | //☆マーク☆ |
| | | //deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | deleteDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | if (result.Code == HttpMessageEnum.A成功) |
| | | { |
| | | isSecondDel = false; |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | doorLock.localDoorLockUserList.Remove(curUserId); |
| | | UndateUnlockMethodAction += (obj) => |
| | | { |
| | | RefreshList(obj); |
| | | }; |
| | | TypeRefresh(doorLock); |
| | | TypeRefresh(); |
| | | } |
| | | } |
| | | else |
| | |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 13: |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintMark) + "ID" + +curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 14: |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.FaceIDMark) + "ID" + +curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 15: |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | |
| | | Action<Shared.View> action = async (obj) => |
| | | { |
| | | var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) |
| | | { |
| | | refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | //☆マーク☆ |
| | | //refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | refreshDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | if (result.Code == HttpMessageEnum.A成功) |
| | | { |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | { |
| | |
| | | localDoorLockObj.PrimaryId = curDoorLockUser.PrimaryId; |
| | | localDoorLockObj.EntryTime = curDoorLockUser.EntryTime; |
| | | localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks; |
| | | localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; |
| | | //☆マーク☆ |
| | | //localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; |
| | | doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj); |
| | | UndateUnlockMethodAction += (obj1) => |
| | | { |
| | | RefreshList(obj1); |
| | | }; |
| | | TypeRefresh(doorLock); |
| | | TypeRefresh(); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 侧边导航栏 |
| | | /// </summary> |
| | | void SideslipFramelayout() |
| | | { |
| | | #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() |
| | | { |
| | | Height = Application.GetRealHeight(625), |
| | | Width = Application.GetRealWidth(449), |
| | | Y = Application.GetRealHeight(115 + 160), |
| | | X = Application.GetRealWidth(596), |
| | | BackgroundImagePath = "DoorLock/SideslipPic.png", |
| | | }; |
| | | flMain.AddChidren(sidelipFrameLayout); |
| | | |
| | | var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() |
| | | { |
| | | Height = Application.GetRealHeight(600), |
| | | Y = Application.GetRealHeight(28), |
| | | }; |
| | | sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); |
| | | #endregion |
| | | |
| | | Button oldbutton = null; |
| | | Button oldbuttonText = null; |
| | | for (var i = 0; i < 4; i++) |
| | | { |
| | | #region rowFrameLayout UI |
| | | var rowFrameLayout = new RowLayout() |
| | | { |
| | | Height = Application.GetRealHeight(150), |
| | | LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | 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); |
| | | #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.currentUserDisplayMethod = btnMethodText.Text; |
| | | doorLock.ReSave(); |
| | | btnAllMethod.IsSelected = true; |
| | | oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | oldbuttonText.IsBold = true; |
| | | TypeRefresh(); |
| | | } |
| | | dialog.Close(); |
| | | }; |
| | | rowFrameLayout.MouseUpEventHandler += hander; |
| | | btnAllMethod.MouseUpEventHandler += hander; |
| | | btnMethodText.MouseUpEventHandler += hander; |
| | | |
| | | DisplayAllUnlockMethod(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); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 类型区分 |
| | | /// </summary> |
| | | void TypeRefresh() |
| | | { |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) |
| | | { |
| | | RefreshList(0); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock)) |
| | | { |
| | | RefreshList(15); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock)) |
| | | { |
| | | RefreshList(3); |
| | | } |
| | | else |
| | | { |
| | | RefreshList(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重写移除方法 |
| | | /// </summary> |
| | | public override void RemoveFromParent() |