| | |
| | | this.doorLock = doorLock; |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; |
| | | ZigBee.Device.ZbGateway.StatusList.Add(this); |
| | | ReadTempPasswordData(); |
| | | } |
| | | |
| | | #region ◆ 变量申明__________________________ |
| | |
| | | DateTime cunIVDateTime; |
| | | #endregion |
| | | |
| | | /// <summary>
|
| | | /// UI显示
|
| | | /// <summary> |
| | | /// UI显示 |
| | | /// </summary> |
| | | public void Show() |
| | | { |
| | | ReadTempPasswordData(); |
| | | this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.TemporaryPassword)); |
| | | |
| | | EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => |
| | |
| | | #region btnDelFrameLayout |
| | | var btnDelFrameLayout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(953), |
| | | X = Application.GetRealWidth(953 - 116), |
| | | Height = Application.GetRealHeight(69), |
| | | Width = Application.GetRealWidth(1080 - 953), |
| | | }; |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = Language.StringByID(R.MyInternationalizationString.ClearTempPassword), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, |
| | | TextSize = 12, |
| | | TextSize = 14, |
| | | IsBold = true, |
| | | }; |
| | | delBackgroundFrameLayout.AddChidren(btnDelText); |
| | | |
| | | EventHandler<MouseEventArgs> eHandler2 = (sender2, e2) => |
| | | { |
| | | ClearEventHandler(btnDelText, dialog); |
| | | }; |
| | | { |
| | | dialog.Close(); |
| | | string msg = Language.StringByID(R.MyInternationalizationString.SureToDeleteTempPassword); |
| | | var alert = new Shared.Phone.UserCenter.ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm)); |
| | | alert.Show(); |
| | | //使用确认型弹框时,的回调函数 |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | ClearEventHandler(btnDelText); |
| | | }; |
| | | }; |
| | | delBackgroundFrameLayout.MouseDownEventHandler += eHandler2; |
| | | btnDelIcon2.MouseDownEventHandler += eHandler2; |
| | | btnDelText.MouseDownEventHandler += eHandler2; |
| | |
| | | Y = Application.GetRealHeight(48), |
| | | TextAlignment = TextAlignment.Center, |
| | | Text = Language.StringByID(R.MyInternationalizationString.ClickGenerate), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextSize = 12, |
| | | Visible = true, |
| | | Enable = true, |
| | | }; |
| | | topMidTopFrameLayout.AddChidren(topPic); |
| | | |
| | | var randomPassword = new EditText() |
| | | { |
| | | X = Application.GetRealWidth(233), |
| | | Y = Application.GetRealHeight(153), |
| | | Height = Application.GetRealHeight(84), |
| | | Width = Application.GetRealWidth(251), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = 24, |
| | | SecureTextEntry = false, |
| | | Enable = false, |
| | |
| | | var validTime = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(55), |
| | | Width = Application.GetRealWidth(115), |
| | | X = Application.GetRealWidth(92), |
| | | Width = Application.GetRealWidth(92 + 115), |
| | | Y = Application.GetRealHeight(386), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = 16, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(validTime); |
| | | |
| | | var validTimeDate = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Width = Application.GetRealWidth(135), |
| | | X = Application.GetRealWidth(84), |
| | | Width = Application.GetRealWidth(84 + 135), |
| | | Y = Application.GetRealHeight(441), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextSize = 10, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(validTimeDate); |
| | | |
| | | var inValidTime = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(55), |
| | | Width = Application.GetRealWidth(118), |
| | | Width = Application.GetRealWidth(717 - 507), |
| | | X = Application.GetRealWidth(507), |
| | | Y = Application.GetRealHeight(389), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 14, |
| | | TextSize = 16, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(inValidTime); |
| | | |
| | | var inValidTimeDate = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Width = Application.GetRealWidth(135), |
| | | Width = Application.GetRealWidth(717 - 508), |
| | | X = Application.GetRealWidth(508), |
| | | Y = Application.GetRealHeight(444), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 10, |
| | | TextSize = 12, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(inValidTimeDate); |
| | | |
| | |
| | | { |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinifh.Enable = true; |
| | | topPic.Visible = true; |
| | | topPic.Enable = true; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinifh.Enable = false; |
| | | topPic.Visible = false; |
| | | topPic.Enable = false; |
| | | } |
| | | if (string.IsNullOrEmpty(doorLock.LocalTempPassword)) |
| | | { |
| | | randomPassword.Text = "- - - - - -"; |
| | | temPasswordVisiable.Visible = false; |
| | | randomPassword.X = Application.GetRealWidth(215); |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true; |
| | | topPic.Visible = true; |
| | | topPic.Enable = true; |
| | | } |
| | | else |
| | | { |
| | | randomPassword.Text = doorLock.LocalTempPassword; |
| | | temPasswordVisiable.Visible = true; |
| | | |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable) |
| | | { |
| | | randomPassword.SecureTextEntry = false; |
| | |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | this.midFrameLayout.AddChidren(bottomFrameLayout); |
| | | bottomFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | |
| | | var informationEdit = new Button() |
| | | { |
| | |
| | | { |
| | | Width = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(58), |
| | | UnSelectedImagePath = "Item/Next.png", |
| | | UnSelectedImagePath = "Item/RightNext.png", |
| | | SelectedImagePath = "Item/Down.png", |
| | | }; |
| | | btnNextFrameLayout.AddChidren(btnNext); |
| | |
| | | { |
| | | if (curIndex == 0) |
| | | { |
| | | if (string.IsNullOrEmpty(doorLock.LocalTempPassword)) |
| | | { |
| | | //请"点击生成"临时密码; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "ValidTime"); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | |
| | | } |
| | | if (curIndex == 1) |
| | | { |
| | | if (string.IsNullOrEmpty(doorLock.LocalTempPassword)) |
| | | { |
| | | //请"点击生成"临时密码; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "InValidTime"); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | |
| | | btnNext.MouseDownEventHandler += hander; |
| | | } |
| | | |
| | | var modifyTempPasswordTip1 = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Y = Application.GetRealHeight(628), |
| | | TextID = R.MyInternationalizationString.ModifyTempPasswordTip1, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | bottomFrameLayout.AddChidren(modifyTempPasswordTip1); |
| | | |
| | | var modifyTempPasswordTip2 = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Y = modifyTempPasswordTip1.Bottom, |
| | | Radius = (uint)Application.GetRealHeight(120) / 2, |
| | | TextID = R.MyInternationalizationString.ModifyTempPasswordTip2, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | bottomFrameLayout.AddChidren(modifyTempPasswordTip2); |
| | | |
| | | btnFinifh = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(907), |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 16, |
| | | IsBold = true, |
| | | Enable = false, |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnFinifh); |
| | |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | try |
| | | { |
| | | if (doorLock.LocalTempPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.LocalTempPassword)) |
| | | { |
| | | //请"点击生成"临时密码; |
| | | Application.RunOnMainThread(() => |
| | |
| | | }); |
| | | return; |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100) |
| | | |
| | | var dNow = DateTime.Now; |
| | | var validDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute - 1, dNow.Second); |
| | | var inValidDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute, dNow.Second); |
| | | if (DateTime.Compare(inValidDateTime, validDateTime) < 0) |
| | | { |
| | | //请设置生效时间; |
| | | //无效的时间设置 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip2), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth == 0) |
| | | { |
| | | //请设置生效日期; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip3), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip4), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth == 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip5), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | var dNow = DateTime.Now; |
| | | var validDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute, dNow.Second); |
| | | var inValidDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute, dNow.Second); |
| | | var startTimeStr = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(validDateTime); |
| | | var endTimeStr = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(inValidDateTime); |
| | | |
| | | action = (topic, data) => |
| | | { |
| | | var gatewayID = topic.Split('/')[0]; |
| | |
| | | } |
| | | //设置临时密码到门锁 |
| | | var addOrModifyResult = await doorLock.TempPasswordAsync(doorLock.LocalTempPassword, validDateTime, inValidDateTime); |
| | | if (addOrModifyResult != null && addOrModifyResult.responseData != null && addOrModifyResult.responseData.status == 0) |
| | | if (addOrModifyResult != null && addOrModifyResult.responseData != null) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | | if (doorLock.tempPasswordObject != null) |
| | | if (addOrModifyResult.responseData.status == 0) |
| | | { |
| | | var addDoorLockTempPasswordData = new ZigBee.Device.DoorLock.AddDoorLockTempPasswordData(); |
| | | addDoorLockTempPasswordData.TempPwd = doorLock.tempPasswordObject.TempPassword; |
| | | if (doorLock.DeviceAddr != null) |
| | | System.Threading.Thread.Sleep(1000); |
| | | if (doorLock.tempPasswordObject != null) |
| | | { |
| | | addDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | var addDoorLockTempPasswordData = new ZigBee.Device.DoorLock.AddDoorLockTempPasswordData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | addDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | addDoorLockTempPasswordData.IsOtherAccountCtrl = true; |
| | | } |
| | | addDoorLockTempPasswordData.TempPwd = doorLock.tempPasswordObject.TempPassword; |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | addDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | addDoorLockTempPasswordData.ValidBeginTime = doorLock.tempPasswordObject.ValidTime; |
| | | addDoorLockTempPasswordData.ValidEndTime = doorLock.tempPasswordObject.InValidTime; |
| | | addDoorLockTempPasswordData.TempPwdId = doorLock.tempPasswordObject.UserId.ToString(); |
| | | //存到云 |
| | | var result1 = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLockPwd", addDoorLockTempPasswordData); |
| | | if (result1 == null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | return; |
| | | } |
| | | if (result1.StateCode != "Success") |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | return; |
| | | } |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = false; |
| | | doorLock.LocalTempPassword = doorLock.tempPasswordObject.TempPassword; |
| | | TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); |
| | | } |
| | | addDoorLockTempPasswordData.ValidBeginTime = doorLock.tempPasswordObject.ValidTime; |
| | | addDoorLockTempPasswordData.ValidEndTime = doorLock.tempPasswordObject.InValidTime; |
| | | addDoorLockTempPasswordData.TempPwdId = doorLock.tempPasswordObject.UserId.ToString(); |
| | | //存到云 |
| | | var result1 = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLockPwd", addDoorLockTempPasswordData); |
| | | if (result1 != null && result1.StateCode != "Success") |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;//XMUnSelect XMBlack |
| | | btnFinifh.Enable = false; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = false; |
| | | doorLock.LocalTempPassword = doorLock.tempPasswordObject.TempPassword; |
| | | TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | catch { } |
| | | catch (Exception ex) |
| | | { |
| | | var mess = ex.Message; |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | |
| | | } |
| | | |
| | | //清除事件处理 |
| | | async void ClearEventHandler(Button btnDelText = null, Dialog dialog = null) |
| | | async void ClearEventHandler(Button btnDelText = null) |
| | | { |
| | | if (btnDelText == null) |
| | | { |
| | |
| | | { |
| | | var passData = doorLock.SetUserAccessData(doorLock.tempPasswordObject.UserId, ZigBee.Device.DoorLock.AccessType.DelCurrentUser); |
| | | var resultData = await doorLock.DefaultControlAsync(passData); |
| | | if (resultData != null && resultData.defaultControlResponseData != null && resultData.defaultControlResponseData.status == 0) |
| | | if (resultData != null && resultData.defaultControlResponseData != null) |
| | | { |
| | | var delDoorLockTempPasswordData = new ZigBee.Device.DoorLock.DelDoorLockTempPasswordData(); |
| | | if (doorLock.DeviceAddr != null) |
| | | if (resultData.defaultControlResponseData.status == 0) |
| | | { |
| | | delDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | var result1 = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLockPwd", delDoorLockTempPasswordData); |
| | | if (result1 != null && result1 != null && result1.StateCode == "Success") |
| | | { |
| | | doorLock.tempPasswordObject = null; |
| | | doorLock.LocalTempPassword = ""; |
| | | TimeDateData(DateTime.Now, DateTime.Now, true); |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = false; |
| | | var delDoorLockTempPasswordData = new ZigBee.Device.DoorLock.DelDoorLockTempPasswordData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | delDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | delDoorLockTempPasswordData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | delDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | var result1 = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLockPwd", delDoorLockTempPasswordData); |
| | | if (result1 != null) |
| | | { |
| | | if (result1.StateCode == "Success") |
| | | { |
| | | doorLock.tempPasswordObject = null; |
| | | doorLock.LocalTempPassword = ""; |
| | | TimeDateData(DateTime.Now, DateTime.Now, true); |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = false; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true; |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1) + ".", Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDelText); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDelText); |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (dialog != null) |
| | | { |
| | | dialog.Close(); |
| | | } |
| | | |
| | | MidFrameLayoutContent(); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | |
| | | try |
| | | { |
| | | var getDoorLockTempPasswordData = new ZigBee.Device.DoorLock.GetDoorLockTempPasswordData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | getDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | getDoorLockTempPasswordData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | getDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | var result = await ZigBee.Device.DoorLock.GetDoorLockTempPasswordFromServer("DoorLock/GetDoorLockPwdPagger", getDoorLockTempPasswordData); |
| | | if (result != null && result.PageData != null) |
| | | if (result != null) |
| | | { |
| | | foreach (var curDoorLockTempPaw in result.PageData) |
| | | if (result.PageData.Count != 0) |
| | | { |
| | | var tpObj = new ZigBee.Device.DoorLock.TempPasswordObject(); |
| | | tpObj.UserId = int.Parse(curDoorLockTempPaw.TempPwdId); |
| | | tpObj.ValidTime = curDoorLockTempPaw.ValidBeginTime; |
| | | tpObj.InValidTime = curDoorLockTempPaw.ValidEndTime; |
| | | doorLock.LocalTempPassword = tpObj.TempPassword = curDoorLockTempPaw.TempPwd; |
| | | doorLock.tempPasswordObject = tpObj; |
| | | TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); |
| | | foreach (var curDoorLockTempPaw in result.PageData) |
| | | { |
| | | var tpObj = new ZigBee.Device.DoorLock.TempPasswordObject(); |
| | | tpObj.UserId = int.Parse(curDoorLockTempPaw.TempPwdId); |
| | | tpObj.ValidTime = curDoorLockTempPaw.ValidBeginTime; |
| | | tpObj.InValidTime = curDoorLockTempPaw.ValidEndTime; |
| | | doorLock.LocalTempPassword = tpObj.TempPassword = curDoorLockTempPaw.TempPwd; |
| | | doorLock.tempPasswordObject = tpObj; |
| | | TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | doorLock.tempPasswordObject = null; |
| | | doorLock.LocalTempPassword = ""; |
| | | TimeDateData(DateTime.Now, DateTime.Now, true); |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = false; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = cur.Month; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = cur.Day; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = cur.Day + 1; |
| | | //doorLock.ReSave(); |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour < 10) |
| | | { |